This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Address allocation
boot:0x5c00-0x6bff
xcl file of the boot:
-Z(CODE)INTVEC=0xFF80-0xFFFF
-Z(CODE)RESET=0xFFFE-0xFFFF
app:0x6c00-0xfcff 0x10000-0x15672
xcl file of the app:
-Z(CODE)INTVEC=0x15F80-0x15FFF
-Z(CODE)RESET=0x15FFE-0x15FFF
I want to jump to the app from the boot,and try to use the mov command -----asm("mov &0x15FFE,PC;"); , but compile error.
the error information is:
Error[Og006]: Error in inline assembly: "Error[433]: Address out of range. Valid range is 0 to 65535 (0xFFFF)."
so how to jump to the address 0x15ffe in the boot code?
thanks!
The reset vector and the interrupt vectors are fixed by the design and need to be at the addresses give in the linker command file (at the top of the 64k Boundary
-Z(CODE)INTVEC=FF90-FFFF
-Z(CODE)RESET=FFFE-FFFF
So you should not change this lines.
Also the entry of the CSTARTUP code and also for the interrupt handlers need to by in the lower 64k memory area as the vectors are only available as 16 bit..
Of course you can then jump immediately to a function in the higher memory area and have the main part of the function there.
If you would like to tell the linker to place your code segments of the normal function into the upper memory change this lines to:
-P(CODE)CODE=0x15F80-0x15FFF
-Z(CODE)CODE_PAD
Thank you for your reply.
OK , now I change Address allocation.
xcl file of the boot:
-Z(CODE)CSTART,ISR_CODE,CODE16=5C00-6BFF
-P(CODE)CODE=5C00-6BFF
-Z(CODE)INTVEC=0xFF80-0xFFFF
-Z(CODE)RESET=0xFFFE-0xFFFF
xcl file of the app:
-Z(CODE)CSTART,ISR_CODE,CODE16=6C00-FC7F
-P(CODE)CODE=6C00-FC7F,10000-25BFF
-Z(CODE)INTVEC=FC80-FCFF
-Z(CODE)RESET=FCFE-FCFF
I write two APP codes. the two codes take up flash memory actually as follows:
APP code 1: 6C00-6F8E
APP code 2: 6C00-FC7F 10000-15482
In the boot code , use the command 【asm("mov &0xFCFE,PC;");】 in order to jump to the APP.
when I download the app code 1 , it can work normally.
when I download the app code 2, it can not work normally.
For the RESET Vector this looks OK but do you also handle the Interrupt functions the same way?
You need to add a interrupt handler for all function you are using in the bootloader and the application.
Once a interrupt occurs and it is enabled it will jump at the program address which is define in the interrupt vector table of the device (memory locations below the RESET vector), which will then based on your configuration jump into an handler which is part of the bootloader. Here you then need to decide if this needs to be handled by the bootloader or if you further branch into the application similar what you have already done with the reset.
**Attention** This is a public forum