This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bootloader LPC1768 - Issues

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 ?

Parents
  • 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);
    
    }
    

    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

    // 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
    

    and

    on Lpc17xx.h

    #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.

    Any help ?

Reply
  • 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);
    
    }
    

    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

    // 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
    

    and

    on Lpc17xx.h

    #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.

    Any help ?

Children