c - Start bootloader from firmware -
i wish able start bootloader directly code without having have pin high , reset microcontroller access it. idea below bootloader binary stored in char array. when start_bootloader() called, bootloader copied sram , executed.
however, code copies ram when attempts execute code @ location have copied to, nothing.
the micro. energy micro efm32380f1024. code below using based on energy micro's application note an0042.
void start_bootloader(void) { /* diable interrupts */ int_disable(); __set_msp( ( 0x20000000 + sizeof( bootloader ) + 0x400 ) & 0xfffffff0 ); /* load entire bootloader sram. */ memcpy( (void*)0x20000000, bootloader, sizeof( bootloader ) ); /* start executing bootloader. */ boot_jump( *(uint32_t*)0x20000000, *(uint32_t*)0x20000004 ); }
the code ships rom , ram linker settings - ram version work in case. try read second word (32 bit little endian) binary - should point odd address in 0x20000000 range, new pc value.
Comments
Post a Comment