There is a system with ADI BlackFin DSP which boots up from SPI flash. The flash contains the standard ADI boot stream.
I would like to insert hw/sw version number, build number, release date and some other information into the flash. This information should be accessible to a program running on Blackfin. Also, the flash programming tools should be able to read this information from the flash hex file.
Is there a way to configure the VDSP toolset so this data would be inserted automatically from a C source to a predefined location in the flash?
Vladimir Vassilevsky DSP and Mixed Signal Design Consultant
I just went through the same exercise with an ARM STM32 based project. Back to the BlackFin. I have not used them, but I used SHARC devices and expect a similar approach will work.
Locate the version information at a fixed RAM address. In the Linker Description File define a segment for the version data along the lines of:
const struct version { /* whatever is needed */ };
I placed the above data in a separate C source file. The structure contains manually edited version information, as well as a time stamp updated at each build, etc.
Since (in my case) the external flash is copied as-is to the internal ram, placing the version block at a fixed RAM address will also place it at a fixed location in the flash boot image.
As I said, I would expect this to work also with a BlackFin, but never tried it. It would fail if, for example, the boot image is compressed or encrypted.
Another approach is to write the version information at the very end of the flash, (with a gap between it an the end of the normal code) and have the BlackFin read it after it is up and running.
-- Roberto Waltman
[ Please reply to the group. Return address is invalid ]
Unfortunately, this won't work for BlackFin as the flash boot stream is not a contiguous image of RAM, but a sequence of separate blocks.
This is what we have to do now. This requires a special file in the project just to store and pass the version information, and the separate software tools to manipulate this file and the flash hex image. It does the job albeit not very elegant. Besides, it is tied to the particular flash size. I wonder if there is a good solution to the problem which seems to be very typical.
Vladimir Vassilevsky DSP and Mixed Signal Design Consultant
Instead of requiring a "predefined location" (admittedly, easier to
*find*), could you wrap the information with a unique signature such that anything else is unlikely to be (erroneously) recognized as having that signature IN THAT REGION OF MEMORY?
E.g., add to the flash image:
"Copyright 08192011 Vladimir Vassilevsky, Build 12.3.4, v9A03"
(assuming this *context* is unlikely to randomly appear elsewhere in your code image :> )
Another way, (which I don't like, but it works.) You can enbedd the version info in the flash image surrounded by "markers" that will allow you to search and locate it anywhere.
#pragma pack()
struct version { char before[35]; int v_major; int v_minor; char date[11]; int checksum; // to reduce the likelihood of false possitives char after[35]; };
struct version this_version = { "find version after this ##########", 0, 0, /* to be updated after build */ "--/--/----", 0, "######### find version before this" };
Of curse, if the boot image includes any checksums to detect corrupted files they will need to be updated after modifying the structure above.
-- Roberto Waltman
[ Please reply to the group. Return address is invalid ]
I figured the string "Vassilevsky" probably stands a greater chance of reducing those sorts of hits! (there are advantages to having "unique" surnames! :> )
Or, ensure the struct's contents are "checksum neutral" (not possible with all checksum algorithms)
That idea almost works... but the maker string could be occasionally broken into two chunks in the boot sequence. So, the flash stream should be interpreted rather then simply searched. If the flash stream has to be interpreted, then I can put a version structure to a predefined location in the target memory map, and everything is simple. Oh, but I don't like writing an interpretor, that's the only problem :-)
Vladimir Vassilevsky DSP and Mixed Signal Design Consultant
Does the "(c)Rob Gaddi" string put an ARM processor into an idle mode ?
Actually, I can remember piece of code that started with a text string "Hello my dear friend". That was a computer game for Sinclair Spectrum. IIRC, that translated to a harmless series of relative jumps on Z80 cpu.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.