Bootloader with printf?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Bootloader with printf?

723件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jaybee on Tue Oct 02 00:05:08 MST 2012
Hi,

I have create a application and used the secondary bootloader create by codered to write my application and jump to it. However, in debug mode, i run the bootloader program, it writes the application and got stuck at the 1st interrupt that occurs.

From the application:

void TIMER1_IRQHandler(void)
{
  RTC_timeMs++;                                //add the ms counter for RTCC
  timeMs_tick++;                        //for other uses
  TIM_ClearIntPending(LPC_TIM1, TIM_MR0_INT);
}



However if i add a printf line...

From the application:

void TIMER1_IRQHandler(void)
{
    printf("timer1\n");
  RTC_timeMs++;                                //add the ms counter for RTCC
  timeMs_tick++;                        //for other uses
  TIM_ClearIntPending(LPC_TIM1, TIM_MR0_INT);
}



The application works perfectly.

However, either way does not work when i disconnect the LPClink.

The bootloader sits at 0x0 to 0x10000.
The application sits at 0x10000 to 0x70000

The code to jump which is copied from codered secondary bootloader has:

   
SCB->VTOR = (0x10000 & 0x1FFFFF80);



What else did I missed?

Thank you.
0 件の賞賛
返信
2 返答(返信)

670件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ArtjomGromak on Thu Oct 04 02:27:39 MST 2012

Quote: jaybee
Hi,



What else did I missed?

Thank you.



May begin end;you missed set MSP and call Reset_Handler?

typedef void (*ISRPtr) (void);
__set_MSP(*(uint32_t *)0x1000);
ISRPtr application_reset_handler=(ISRPtr)(*(uint32_t *)0x1004);
application_reset_handler();
0 件の賞賛
返信

670件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by daniel.widyanto on Thu Oct 04 02:08:27 MST 2012
Hi,

I wonder how do you get the printf()? If you don't provide your own printf(), most probably you're using CodeRed's semi-host library to print the message to the JTAG's output terminal. This library is non-functional when the JTAG is not available (it will hang waiting for JTAG connected).

NXP provides a lot of application notes regarding bootloader. If you use ARM Cortex M3, you can check:
[LIST]
[*]http://www.nxp.com/documents/software/AN11258.zip
[*]http://www.nxp.com/documents/software/AN11257.zip
[*]http://www.nxp.com/documents/other/AN10866.zip
[/LIST]

To jump to user code, most probably you will also need to init the stack pointer before jumping out of the bootloader. Refer to the app note codes for the exact details.
0 件の賞賛
返信