AnsweredAssumed Answered

Executable Sections Do Not Match Linker Definition File

Question asked by DonMilne on May 31, 2012
Latest reply on Jun 13, 2012 by DonMilne

I'm doing Blackfin development using VisualDSP++ v5 update 9.1.


The following is not exactly a bug, but I consider it unexpected (and undesirable) behaviour.


In my work I sometimes need to embed data in a flash image after the image has been created by the ADI tools. For example, on safety systems I test for corruption of the flash using a CRC which I embed in the flash image in a post build step. My normal way of doing this safely, which I've used for many years, is to create a special linker section inside which I can reserve space for this additional data. The linker section would be identified by a signature string at the beginning, or by its relocation address (e.g. it would be the first section assigned to L1_data_a).


I recently discovered that the linker was not creating true BSZ sections (it was instead creating constant data sections filled with zeros, thus inflating the flash image size). This turned out to be a workaround for anomaly 05000138, which I could switch off by setting the target silicon revision to 0.3 or later.


However, when I did so the device acted really weird, crashing, resetting etc. But when I ran it under JTAG it ran perfectly...


So, I decided to take a closer look at the BSZ sections in the loader file using "LdrViewer", and I discovered that there was many more BSZ sections than I expected!  Apparantly the loader has this feature that, if it detects a run of zeros in a linker section, it breaks this section into multiple parts, with the zero run replaced by a BSZ section (zero fill block). Of course this takes no account of the possibility that this run of zeros is supposed to be initialized with non-zero data in a post build step, or that I am expecting the ROM image to reflect the LDF I configured!


IMHO, this is the tool being too smart for its own good. While there are several workarounds for this specific problem, I have no workaround for the ADI devteam putting other tricks like this into future tools.


So, can we please have a "plain vanilla linker" option please, and have it default to enabled!