lpcware

LPC1788 USB bootloader - Issue with user program

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by zou9a on Thu Apr 07 06:21:50 MST 2016
Peace be upon all of you,

I have recently searched for an USB bootloader for LPC1788 to use it with my application, but I have never found an exemple. Starting from the code Red exemple (1) based on LPC1768, and following the application note (2) and the user manual to well understand what I'm doing, I have write a bootloader for the LPC1788. I can update firmware (user app) and execute some user application like a blinky without any problems. Now, I'm trying to execute my application (LCD+EMC_SDRAM+TS+RS485+GPIO...) and updated if necessary using this boot loader. Briefly: It doesn't work.
Last work I have done: I debug (with my firmware on flash starting at sector 16 0x10000) the USB bootloader. The bootloader detect that code is present, and when trying to execute it, I got IntDefaultHandler (pic 1). I have no idea why I get this interrupt, so I thak you for help.
Code that execute firmware and remapp vector table:
void execute_user_code(void) {
void (*user_code_entry)(void);
unsigned *p;// used for loading address of reset handler from user flash
/* Change the Vector Table to the USER_FLASH_START
in case the user application uses interrupts
According to UM: 5.4 Vector table remapping */
SCB->VTOR = USER_FLASH_START;
// Load contents of second word of user flash - the reset handler address
// in the applications vector table
p = (unsigned *)(USER_FLASH_START + 4);
// Set user_code_entry to be the address contained in that second word
// of user flash
user_code_entry = (void *) *p;
    user_code_entry();
}

Why to execute user code we must point to the second word of USER_FLASH_START and not the first? Where can I find an explanation of the structuration of a code (the BIN file)?
When I try to read the firmware.bin (all user memory) with an HEXEditor, last address is 0x60FF and not 0x7FFFF? But windows show that space of flash is 448KB (that correct 0x70000).

(1). http://www.support.code-red-tech.com/CodeRedWiki/RDB1768cmsisExampleProjects
(2). http://www.nxp.com/documents/application_note/AN10866.pdf

Attachments

Outcomes