Hi there,
I'm trying to clarify Ram & Flash usage of SAMB11 module.
According to specifications and datasheet SAMB11 has 128KB of Ram and 256KB of Flash. As an example, when compiling my code the arm-none-eabi-size tool from Atmel Studio toolchain shows the following result:
text data bss dec hex filename 75748 120 15788 91656 16608 mcu.elf
and RunOutputFileVerifyTask shows:
Data Memory Usage : 15908 bytes 11,4 % Full
So in theory (http://support.code-red-tech.com/CodeRedWiki/FlashRamSize):
* Ram usage: 15908 bytes (data + bss) - 12,4% Full
* Flash usage: 75868 bytes (text + data) - 29,6% Full
After implementing new functionnalities, I got the following error at compilation:
mcu.elf section `.bss' will not fit in region `ram'region `ram' overflowed by 7568 bytescollect2.exe(0,0): error: ld returned 1 exit status
So I started to figure out the reason of this issue, and I found that the issue occurs when code size (text+data+bss) exceeds 96KB.
According to this post https://community.atmel.com/forum/samb11-spi-flash-memory-address?skey=samb11, on startup bootloader of SAMB11 fetches flash application code and load it into Ram:
SAMB11 contains ROM which is one time programmable from Atmel. This ROM will hold the BLE core functionality related code. Once the ROM is programmed with this firmware, will not be able to write or erase. SAMB11 also has internal stacked flash connected through SPI interface. This flash can be used to hold the application code like profiles/services/user application which runs on top of BLE core firmware. This application code is written to Flash using the SWD interface, and there is a bootloader code in ROM, on startup will fetch this flash application code and place it in internal RAM. The application code of 128K max will run from the RAM. The remaining 128K flash in 256K flash may be for OTAU upgrade..
It means that application code size shall be less than 128KB. In fact, according to the document SAMB11 SW_Architecture_v4_1.pdf posted on thre previous mentionned post, only 96KB of the 128KB of Ram are available for user application code. The memory map from SDK (attached file) seems to confirm this. In linker script file samb11g18a_sram.ld, we can also see that .text datas is related to ram section.
Can anyone confirm my undestanding which is:
- Use app code is loaded in Ram at startup by bootloader ?
- User app code size shall be less than 96KB ?
Thanks a lot.