SAMB11 - RAM & FLASH usage

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1) This is correct. It's also the reason why you see a startup delay of ~3~4 seconds while the data is copied. On mcu's without this flash+ram construction startup is almost instant.

 

At first I thought the SAMB11 was a BTLC1000 with spi flash added on (as stated as one of the possibilities in the BTLC1000 sheets), but as it has more gpios, it seems an additional m0 core is added. They should have just added an existing SAM core because right now I find the software libs and documentation for the SAMB11 lacking in lots of places

 

2) From my experience this is correct.

 

The 256Kb is divided by 2 (this allows for OTAU which is working perfectly on my board), and the 128Kb also needs to contain the patch image section so Atmel/Microchip can correct software errors in the Bluetooth Stack from ROM.