OpenNuvoton / M480BSP

BSP for M480 Series MCU
Apache License 2.0
40 stars 39 forks source link

M487KM 2 Partition question! #40

Closed viobiscu closed 5 months ago

viobiscu commented 5 months ago

I run on M487KM and have divided the memory in 2 BANK as per existing MACROS: FMC_APROM_BASE as start address for Partition 1 and FMC_APROM_BANK0_END as start address for Partition 2

Then I use the FMC_SetVectorPageAddr(StartAddress); in LD_ROM program to decide from which partition to run.

Question: After I start the program in AP_ROM, How do I recognise from which Address space is the code running?

viobiscu commented 5 months ago

I find this solution:

` printf("Boot from %d\n", FMC_GetBootSource());

uint32_t adres_main = (uint32_t)&main;

printf("Address %x\n", adres_main);

printf("Run from %s\n", adres_main < FMC_APROM_BANK0_END? "Partition 1":"Partition 2"); `