SAMD21J18A - region `ram' overflowed by 1372 bytes

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

Hi All

 

I am working on a wifi project that requires a root certificate on to the SAMD21.

 

It seems I am running out of RAM memory.

 

Is there away to save this in flash part of the device, and then when need to also read it from the flash part of the memory?

 

 

 

 

Thanks

Regards

DJ

Last Edited: Fri. Apr 8, 2022 - 10:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to get pstr() or somthing similar working with SAM devices?

Thanks

Regards

DJ

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

How can i close this post, has i noticed that the should have open the post on 

Atmel Cortex-M MCUs | AVR Freaks

 

Thanks

Regards

DJ

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

You're in the wrong forum for ARM but anyway.. .

 

Putting stuff in flash is actually easier on ARM than AVR. You don't need PROGMEM/PSTR() /etc. Just make things "const", they should then be placed in .rodata then the linker script places that in flash. Don't use inline strings (unless a check shows they are already in. rodata) but define separately then pass the pointer. 

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

Thanks

 

I have used Cosnt as in.. 

 

const uint8_t mycert_pem[]={0x30,0x82,0x03,0x8e,0x30,0x82,0x02...}

//m2m_wifi_deinit(NULL);
 m2m_wifi_download_mode();
 WriteRootCertificate(mycert_pem,sizeof(mycert_pem));
//m2m_wifi_reinit()

But i get the following error:

 

Severity	Code	Description	Project	File	Line
Error		WifiNode_Device.elf section `.stack' will not fit in region `ram'	WifiNode_Device		1
Error		region `ram' overflowed by 1372 bytes	WifiNode_Device		1
Error		recipe for target 'WifiNode_Device.elf' failed	WifiNode_Device	C:\Users\djosh\Downloads\FWM0004-WINC3400_WIFI_NODEV2\FWM0004-WINC3400_WIFI_NODEV2\Wifi_Node\Debug\Makefile	1353
Error		ld returned 1 exit status	WifiNode_Device	collect2.exe	0

 

It seems it is still trying to save it in RAM.

Thanks

Regards

DJ

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

Maybe it's other data pushing you over the edge...

 

const uint8_t mycert_pem[] = {0x30, 0x82, 0x03, 0x8e, 0x30, 0x82, 0x02, 0x30, 0x82, 0x03, 0x8e, 0x30, 0x82, 0x02, 0x30, 0x82, 0x03,
                              ...
                              0x30, 0x82, 0x03, 0x8e, 0x30, 0x82, 0x02, 0x30, 0x82, 0x03, 0x8e, 0x30, 0x82, 0x02,
                             };


void setup() {}
void loop() {
  Serial.print((const char *)mycert_pem);
  delay(5000);
}
arm-none-eabi-nm -SC /tmp/Arduino1.8.15Build/*.elf | grep pem
0000445c 00000070 t mycert_pem

 

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

I am using a WiFi stack, which is using 75% of ram but I would like to store the certs onto the flash ROM.

 

So what do I need to do?

Thanks

Regards

DJ

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

I would like to store the certs onto the flash ROM.

"const" should be doing that. You haven't really provided evidence that it's not doing so.

Try running the arm-none-eabi-nm utility on the individual .o files, looking for data and/or bss symbols that are unexpectedly large (or not "in the .text segment as expected.")

arm-none-eabi-nm -SC --size-sort */*.o | grep " [BbDd] "

00000000 00000004 B sercom0
00000000 00000004 B sercom1
00000000 00000004 B sercom2
00000000 00000004 B sercom3
00000000 00000018 D g_apTCInstances
00000000 000002fc B Serial1
00000000 00000004 B LEDstate
00000000 00000004 b delay_without_delaying(unsigned long)::previousmillis
00000000 00000004 B pixelColor
00000000 00000010 D ports
00000000 00000018 B pixels
00000000 0000001c B USBSer1
00000000 0000001c B USBSer2
00000000 00000060 B line0
00000000 00000060 B line1
00000000 00000060 B line2