SAMR35 RAM Usage

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

Hello, I'm writing a project for the SAMR35 module.

The code is getting a bit heavy(194KB of the 256KB available), as the device has to do a lot of things and it eventually stops running.

When debugging I found that the last addresses of the HSRAM are filled up and in the "Call stack" tab i see the following messages:

	NUC4-R35.elf! Dummy_Handler Line: 258	
 	NUC4-R35.elf! <signal handler called> Line: 258	
 	NUC4-R35.elf! _malloc_r Line: 258	
 	NUC4-R35.elf! malloc Line: 258	
 	NUC4-R35.elf! print (const cJSON * const item, cJSON_bool format, cJSON_bool format@entry, const internal_hooks * const hooks, const internal_hooks * const hooks@entry) Line: 1190	
 	NUC4-R35.elf! cJSON_PrintUnformatted (const cJSON * item) Line: 1253	
 	NUC4-R35.elf! EnviarRegistrosHorarios (int horasAtras, int horasAtras@entry, int contadorUltRegistro, time_t timerActual) Line: 471	
 	NUC4-R35.elf! EES34_appTask Line: 400	
 	NUC4-R35.elf! APP_TaskHandler Line: 435	
 	NUC4-R35.elf! SYSTEM_RunTasks Line: 106	
 	NUC4-R35.elf! main Line: 153	

The Dummy_Handler has the following code (this is part of the stack):

 * \brief Default interrupt handler for unused IRQs.
void Dummy_Handler(void)
        while (1) {

The code enters the while (1) and it obviously stops doing anything else.


The application is a LoRa-LTE device that has RS-232 port to interface external devices, as well as a SPI flash memory to store data. It connects thru usart to a LTE module for high data communications, and it is during this communication with the LTE module that the program enters in the Dummy_Handler error.

I am currently reading and trying to apply some of the considerations explained in the application note : "AT08569: Optimizing ASF Code Size to Minimize Flash and RAM Usage".

But I am having a hard time understanding some of it.


Do you have any advice in regards with this problem?


Thank you for your time.

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

Note to self:

I managed to make it work optimizing the code.

However, there is still more optimization to do, due to the fact that after 2 months of runtime the device stops working and needs a hard reset to start again.