Memory Violation ATSAM3X8

Hi,
project PIO, ATSAM3X8, Framework Arduino.
simple bootloader on Flash, loader code in RAM call code, execute.
load code call direct ( my entry_main_ram) 0x20000000 area ok.

see: run ok , file flash.ld and sram.ld compiling separately (flash)

void entry_main_ram(){ 
uint32_t led =0;
 while(1){
     digitalWrite( L1, led );
      led ^=1;
   }
}
//----------------------
problems violation cause reset processor:
void entry_main_ram(){ 
bool bl = true;            // add it, reset processor , call
 while(1){
     
    digitalWrite( L1, bl = !bl ); not effects, in flash ok
  set_invet_led();  simple call reset processor

  }
}
//---------------------see list call reset processor
Serial.begin(9600); reset processor
pmc_enable_periph_clk(ID_CAN0); reset processor
can_init(CAN0, 84000000, 500); reset processor

execute code on ram error.
thanks,
Carlos.

hi,
problems solved,

thanks,
Carlos.

Hi, can you quickly explain how you solved the issue? It might help the community if anyone has similar issues.
Thanks

Hi,
problms it, call direct pointer entry_main_ram()
not loader local variables…

ADD

void Loader_Handler( ){        
   uint32_t *pSrc, *pDest;
	pSrc = &_etext;
	pDest = &_srelocate;
 	if (pSrc != pDest) {
		for (; pDest < &_erelocate;) {
			*pDest++ = *pSrc++;
		}
	} 

	for (pDest = &_szero; pDest < &_ezero;) {
		*pDest++ = 0;
	}
}
//-------------------------------------------

thanks,
Carlos.