The example C linker definition file (LDF) for the TS201 contains the following section:
FILL(0xb3c00000) // Fill any gaps with NOPs.
INPUT_SECTIONS( $OBJECTS(program) $LIBRARIES(program) )
// The next line adds 10 nops after the last piece of code in the
// code section. This is required on TS201 to prevent uninitialised
// memory getting into the pipeline.
. = . + 10;
Since our program section is larger than a single TS201 RAM block, we have defined another similar output section (M2Code) in our LDF. However, we are running into problems.
If the last input section for M0Code happens to end within less than 10 words from the end of M0Code (this is out of our control), then the linker gives an error something like,
[Error li1040] "bl_ts201.ldf":54 Out of memory in output section 'M0Code' in processor 'P0'
Total of 0xA word(s) were not mapped.
Apparently the linker ensures it has room for an integral number of input sections in the output section, but does not ensure that there is room for the 10 NOPs. Then, once it has allocated the input sections, it realizes it doesn't have enough room for the 10 NOPs.
I have two resulting questions:
1. Is the 10-NOP padding really necessary? I cannot find any documentation (other than the sample LDF) that says it is necessary. What is the risk of having invalid op-codes in the pipeline (as long as they don't actually execute)?
2. What is the recommended solution when the program section can be larger than a single RAM block?