MC1322x memory

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC1322x memory

1,214 Views
AlanCollins
Contributor V

The correct memory sizes are the following: RAM 96Kbytes, ROM 80Kbytes, and FLASH 128Kbytes.

        If you use the 96Kbytes for program and Data code the excess capacity is 28Kbytes (128K – 96K – 4K), because the Flash is mirrored into RAM at the beginning of the code, and then the program runs over RAM. The extra 4K is for reserved and protected for factory use. These 4Kbytes are located in the top 4k in FLASH memory (0x1_FFFF - 0x0_1000).

        If you use less than 96Kbytes, the excess of capacity changes dynamically. I mean if you use 50K of program code (example scenario), this memory will be mirrored into RAM and you better not overwrite it because the program will be lost. Also, you will be using 1K for data code (example scenario). From this scenario you will have 45Kbytes extra in RAM and 78Kbytes in FLASH.

You still may use this extra FLASH memory by using the NVM drivers (please refer to 22xDRVRRM.pdf, located in the BeeKit installation folder). Now we need to know which locations of the memory are being used by the program code, in order to not overwrite it. You may know this by looking at the “.map” file generated in the IAR workbench workspace. Here you may see which locations are used in the RAM memory, but knowing that these locations are mirror the same used in the Flash memory + 8 bytes. Please refer to the following example:

   FLASH                      RAM

0x0000 0008 0x0040 0000          

….

0x0001 8007 0x0041 7FFF  RAM ends

0x0001 FFFF

The extra 8 bytes are because of the bootstrap sequence. When the MCU starts it tries to boot from FLASH and check the first 4 bytes for an “OKOK” data, the next 4 bytes have the total program code size used for the application. This way the MCU knows how much memory needs to be mirrored into RAM. This is why the “dynamic” extra memory capabilities. Please accept my apologies for another error in the documentation: Chapter 4.5, Figure 4.1 Memory map. The RAM3 ends in 0x0041_7FFF instead of 0x0041_FFFF. I have requested the immediate changes for these errors.

Please notice that ROM has pre-loaded drivers to use the MC1322x peripherals, and it is not writable.

Tags (3)
0 Kudos
0 Replies