This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Operation of Region$$Table$$Base and variable initialisation

Hi All

Does anyone know how the Region$$Table$$Base / Region$$Table$$Limit and region table works? (Cortex M4 project causing problems...)

Normally the Keil initialisation routines uses these to initialise variables (.data and .bss at least) but in this project the initialisation needs to be performed without these start-up files and at the moment is is not operating correctly and the content doesn't make full sense.

1) The table (in this example case) consists of 8 long words. The first three look quite obvious, being:
- source location (in FLASH) to be copied to initialised data
- destination location (in RAM to be initialised)
- length (the number of bytes to be initialised)
- the final long word's meaning is not known - maybe there are some flags or it has some special address (?)

2) Comparing the table's content with the map file it seems to make half-sense:
- the RAM addresses match the start of .data and .bss area
- the lengths of these ares are also correct in both cases
- the source location to be used for the initialised variables copy looks good - it is (in this case) just after the region table, which is itself just after the code and consts.
- it is not clear what the 4th long word is for in each case. I thought that it may be flagging whether the area is to be zero filled or copied, but, in any case, it looks as though the final block is thee one to be zero filled.

3) The big problem is that there are 174 initialised bytes to be copied but there are only 84 bytes of initialised data in the file just following the region table. The result is that 174 bytes are copied from FLASH to initialised data but only the first 84 of them have values - the rest are set to 0xff (since Flash is empty and nothing else exists there) The first variables which are copied also don't match the expected values.

4) I find the following in the map file:

Code (inc. data) RO Data RW Data ZI Data Debug

21550 1246 1846 372 1832 317460 Grand Totals

21550 1246 1846 84 1832 317460 ELF Image Totals (compressed)

21550 1246 1846 84 0 0 ROM Totals

Here the 84 byte size is seen and also there is the (compressed) in brackets.

Does this mean that the data is stored in a compressed from and need to be decompressed when copying?

Any ideas?

Regards

Mark

0