Sirs
I am needing help on how to mount uv4 simple project to start the development of my bootloader. My design is :
- LPC1768 - AT45DB041D-SU (Data Flash), on SSP - Tibbo EM202, as ethernet-serial converter
The initial questions are:
- How to configure the keil project to launch any application to run/debugger at address 0x6000 ? I tried to configure IROM1 = 0x2000, but doesnt work. (I've called the System_Init() as first line of main() routine)
So What do I need to do ?
If I understand you correctly, your application at 0x2000 only runs if activated from your boot loader. Not when you instead tries to get the debugger to directly start execution at 0x2000.
The question then - what startup code does the application have? And what startup code does the boot loader have?
A direct jump to 0x2000 from the debugger means that you haven't run the code from the startup file of the boot loader which might do something that your main application forgets to do. Who is remapping the interrupt vector table into RAM?
At 0x0000
<prev> #include "type.h" #include "LPC17xx.H"
#define USER_FLASH_START 0x00002000
void execute_user_code(void) { void (*user_code_entry)(void);
SCB->VTOR = USER_FLASH_START; user_code_entry = (void (*)(void))((USER_FLASH_START)+1); user_code_entry(); }
int main(void) {
SystemInit(); execute_user_code(); // call while(1); } </prev>
It's run perfectly. Note that each Keil project I have separated files to manipulate : lpc17xx.h, core_cm3.h, system_lpc17xx.c, startup_lpc17xx.s (I use folders named /common/src and /common/inc under the /source folder)
Yesterday, I change a system_lpc17xx.c of my application (that runs at 0x2000). I put at end of this file the following code <prev> // Set Vector table offset value #if (__RAM_MODE__==1) SCB->VTOR = 0x10000000 & 0x3FFFFF80; #else SCB->VTOR = USER_FLASH_ADDRESS & 0x3FFFFF80; // SCB->VTOR = 0x00000000 & 0x3FFFFF80; #endif </prev>
and
on Lpc17xx.h
<prev> #define USER_FLASH_ADDRESS 0x00002000 </prev>
After that debug runs ok, but there are a curious flash data written on <prev> 0x0000001C 0007 MOVS r7,r0 0x0000001E 0000 MOVS r0,r0 </prev> I've noted this on disassembly window. I am searching for the reason.
Any help ?
At 0x0000, i wrote a simple application
#include "type.h" #include "LPC17xx.H" #define USER_FLASH_START 0x00002000 void execute_user_code(void) { void (*user_code_entry)(void); SCB->VTOR = USER_FLASH_START; user_code_entry = (void (*)(void))((USER_FLASH_START)+1); user_code_entry(); } int main(void) { SystemInit(); execute_user_code(); // call while(1); }
Yesterday, I change a system_lpc17xx.c of my application (that runs at 0x2000). I put at end of this file the following code
// Set Vector table offset value #if (__RAM_MODE__==1) // <--- i didn't discover the definition on project yet !!! SCB->VTOR = 0x10000000 & 0x3FFFFF80; #else SCB->VTOR = USER_FLASH_ADDRESS; // change the vector to desired address // SCB->VTOR = 0x00000000 & 0x3FFFFF80; #endif
#define USER_FLASH_ADDRESS 0x00002000
After that debug runs ok, but there are a curious flash data written on
0x0000001C 0007 MOVS r7,r0 0x0000001E 0000 MOVS r0,r0
I've noted this on disassembly window. I am searching for the reason.
Hi,
have you looked at the application note of NXP? It explains well how to make the bootloader with the LPC1768.
ics.nxp.com/.../an10866.zip
good luck.