Dear All,
I use LPC1778 and try to divide internal flash memory for my handmade bootloader and firmware. And when i set another IROM1 start address for my firmware (for example 0x1000) i see SWD Communication Failure message in window "Building Output". After that i can't debug or update my mcu. Can use only ISP. Why changing IROM1 start address is stopping MCU? What i have to do to run my code from any address? P.S. When i use LPC2367 there is no these problems. P.P.S. My version 4.53
I trying apply RAM_MODE, REMAP commands for my startup file. But doesn't work. With best regards, Vladimir.
I think you must to say thanks these people who help me! :-) With best regards, Vladimir.
Hi Vladimir,
Referred to few of your previous posts and the issue is now resolved! thanks!
-Vani
Unfortunally i don't use RTX. And therefore i can't help you in this question. But when i search in this forum, i found some messages with RTX and bootloader. Try to use search in this forum.
Thanks for the info Vladimir!. What i have done is- used the jump instruction and it works fine. Now, I have introduced RTX in my App code - as soon as I do that - the jump does not work fine. Is there something special that needs to be done in case of RTX in App code?
Boot code goes like this:
typedef void ( *AppCode )(void); static const AppCode AppCodeStart = (AppCode)(0x4001); int main(void) { __disable_fault_irq( ); AppCodeStart(); }
When there is no reference to RTX there is no issue. But as soon as I introduce RTX in App code - my jump comes back to the boot
Hello. As you can see in second message. You have to write correct jump in your application. And you will need to use "NO CRP" key in your main project settings (Tab "ASM"). And my mistake was is using variables with __attribute__((at(0xxxx))). And if my variable was locate in sector with bootloader, after writing main firmware my bootloader was ereased.
With best regards, Vladimir.
Could you just share whart exactly you did to get your code running?
I have my boot code start at 0x00 and app code start at 0x4000. Whenever I download the app code I get similar issue!! Also, I want to jump from boot to app, I just did that without vector table relocation and it just resets (at the jump instruction it comes back to start of the boot). Any guesses why it behaves so?
Thanks in advance! Help appreciated
nice you got it running and thanks for the reply!
BR, /th.
Oops!!
That's always a risk with hard-coded absolute addresses!
Thanks for taking the time to give the conclusion.
I sorry, but i'am made big mistake. I use some variables with __attribute__((at(0xxxx))) And durind writing main firmware bootloader was cleared too. Now it's work fine. Thank you veru much for help! Big thanks 'Thorsten Arm' for bootloader code!
I think it would be the best if you directly contact our support team by creating a support request. There you can also upload your code that we can check & discuss it with you.
This forum is a User2User forum, and not regularly monitored by our support team.
Dear Keil Support! I wrote simple bootloader. And seems it's work. But when i download my firmware(0x10000 address) via button "Download". My bootloader is not start. And i see SWD communication error. But most interesting, that durind downloading it is write some data in 0x300 address. And after that my bootloader is not start. It's possible to fix it?
I removed .ini file. And created bootloader with next code:
#define NVIC_VectTab_FLASH 0x10000 #define SP_OFFS 0 #define RESET_OFFS 4 int main (void) { //========== NEW BOOTLOADER FOR CORTEX-M3 ================= void (*user_code_entry)(void); register uint32_t MSP __ASM("msp"); SCB->VTOR = NVIC_VectTab_FLASH; user_code_entry = (void (*)(void))(( *((unsigned int *)(NVIC_VectTab_FLASH + RESET_OFFS))) ); MSP = *((unsigned int *)(NVIC_VectTab_FLASH + SP_OFFS)); user_code_entry(); }
And after burning my programm from: 0x10000 address I see next message:
SWD Communication Failure.
Where is my mistake? Please help.
Thank you very much! It's really looks better. I add .ini file as initialization file in debug/simulator.
FUNC void Setup (void) { SP = _RDWORD(0x10000000); // Setup Stack Pointer PC = _RDWORD(0x10000004); // Setup Program Counter _WDWORD(0xE000ED08, 0x10000000); // Setup Vector Table Offset Register - VTOR } LOAD %L INCREMENTAL // load the application Setup(); // Setup for Running g, main
And try to run my programm in simulator. But it doesn't work even in simulator... It's stoped in 1st instruction :
0x00000000 0000 MOVS r0,r0
Where is my mistake??? Does anyone knows?
With best regards, Vladimir
I'am sorry if i reviled you. But specialists on this site recomend me to find and add .ini file in project. And i just don't know how to correctly post code.
View all questions in Keil forum