LPC1788 + FreeRtos or RTX + bootlader + Ethernet

Status
Not open for further replies.

yanvaslij

Newbie level 3
Joined
Nov 7, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
24
[ARM] LPC1788 + FreeRtos or RTX + bootlader + Ethernet

Hi all,

I have try to develop an ethernet bootloader via tftp. First program (bootloader is placed in 0x0000-0xFFFF adress area) gets bin file from tftp-server and flashes it to from 0x10000 to the end of IROM. After all it jumps using this:
Code:
__asm void boot_jump( uint32_t address )
{
  LDR SP, [R0]            ;Load new stack pointer address
  LDR PC, [R0, #4]      ;Load new program counter address
}

/**
 * @brief Jump to second program
 *
 * @param address
 */
void jumpToProgram (uint32_t address)
{
        SCB->VTOR = address & 0x3FFFFF80;
        boot_jump(address);
}

//some code here
...
        // jumping to second program from bootloader
        else if(memcmp("jump\r", str, strlen("jump\r")) ==0 )
        {
            vTaskEndScheduler();
            jumpToProgram(0x10000);
        }
...
//some code here

Second program is shifted to 0x10000 by compiler (IROM1 start parametr is 0x10000). It works if I don't use any RTOS in second program. If I do, then program crashes at starting sheduler (vTaskStartScheduler() in FreeRtos or os_sys_init() in RTX). Furthermore I figured out that if I exclude frome bootloader file EMAC_LPC177x_8x.c the second program starts working (sheduler starts) after jumping in it from bootloader. What is wrong?
Regards Vasilij
 
Last edited:

Problem solved! I call SystemInit in second program. It reinitialize VTOR to 0x0000 value:
Code:
void SystemInit (void)
{
//some code
...
#ifdef  __RAM_MODE__
  SCB->VTOR  = 0x10000000 & 0x3FFFFF80;
#else
  SCB->VTOR  = 0x00000000 & 0x3FFFFF80;
#endif
}
So I should to remap vectors in second program after systemInit or shouldn't call systemInit in second program.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…