AN10995 - Hardfauld problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AN10995 - Hardfauld problem

1,804 Views
thomashavregaar
Contributor II

Hi

Im trying to get the AN10995 secondary bootloader to work on my LPCXpresso LPC1114 test board.
When building the bootloader, and opening the terminal program (tera term), i recive C, showing the bootloader is ready for reciving application file. by using xmodem via tera term, to transfere a application (application from AN10995), the terminal then stops reciving C, meaning the transfere has ended, and afterwards is the board reset, now checking the transfered program, validating the checksum and shows a success, but when the program tries to run the inline assembly code (see below), it seems as the program is frozen.

/* Load main stack pointer with application stack pointer initial value,
     stored at first location of application area */
  asm volatile("ldr r0, = 0x1000");
  asm volatile("ldr r0, [r0]");
  asm volatile("mov sp, r0");
  /* Load program counter with application reset vector address, located at
     second word of application area. */
  asm volatile("ldr r0, = 0x1004");
  asm volatile("ldr r0, [r0]");
  asm volatile("mov pc, r0");
The debugging showed that the program steps through the assembly commands above, but afterwards jumps to the "Hardfault_Handler" (see code below). This resoults in the IDE giving me an error (error reported by target, included as image)
void HardFault_Handler(void)
{
 /* Re-direct interrupt, get handler address from application vector table */
 asm volatile("ldr r0, =0x100C");
 asm volatile("ldr r0, [r0]");
 asm volatile("mov pc, r0");
}
I haven't changed any of the initial settings of either bootloader or application
Hope someone can give me a hint on what could be the problem. 
 
Labels (1)
0 Kudos
8 Replies

1,439 Views
thomashavregaar
Contributor II

Hi Con Verse 

I tried your suggestion and followed your link, but when trying to view the registers, i only saw the VECTPC having n/a, and was reciving additional errors when trying to debug / step through the code. I have attached my current version of the AN10995 project for the LPC1114/302 i try using, and was woundering if ofthers are getting the same errors, or if someone has a working version of the an10995 secondar bootloader, they could try to post. have tried 2 different versions of the project and none of them work from the get go.

hope somebody can help  

0 Kudos

1,439 Views
thomashavregaar
Contributor II

Hi

I have also noticed when trying to run debug on the bootloader, am i constantly getting this:bootloader error_4.png

0 Kudos

1,439 Views
converse
Senior Contributor V

That is because the PC has gone to 0xffffffff (minus the thumb bit). I suggest you look at this FAQ

https://community.nxp.com/thread/389002 

0 Kudos

1,439 Views
thomashavregaar
Contributor II

Hi jeremyzhou

How do you manage to implement the programs in another way using the IDE, and where you making any changes in the LINKER settings of the projects (bootloader or application).

It might be me who has overloocked somthing, but isen't the application (placed at 0x1000) suppost to use a vector table located in sector 1 insted of sector 0.

my problem is that when it comes to executing the assembly code it jumps to the hardfault handler, and responds with errors, i was therefore thinking it might be a problem with the reference to the correct memory address, but not sure how to check this.

0 Kudos

1,439 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Thomas Havregaard Soerensen,

I created the application code by KEIL, and the IDE supports to customize the linker file for program the execute file to assigned area. You can learn the exactly setting via Google.

I'd highly recommend you to open a memory window to confirm the application whether locates the start address 0x1000 or not when you debug the bootloader code in the LPCXpresso.

As you know, I didn't do anything change about the bootlaoder code either.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,439 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Thomas Havregaard Soerensen,

Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.
I was wondering if you can exemplifies the steps of testing.
And I hope I can replicate your issue on MCB1114 as I didn't have the LPCXpresso LPC1114 on hand now.
I'll inform you if work it out.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,439 Views
thomashavregaar
Contributor II

Hi jeremyzhou
after the zip file containing the project was imported i opened the bootloader project, and build the project. at first i had a few building issucess, based on a missing line in the linker description. After the project successfully was build, i used the debug function for the project. after this was a success, i connected my leptop with the board using a usb to serial adaptor, enabeling a terminal program to communicat with the board via uart. Then I opened a terminal program. in my case tera term, and saw 'C' was printed too the terminal, indicating that the bootloader had checked the boards eeprom and was ready to recive a new file (.hex). In tera term i then pressed file -> transer -> XMODEM -> send, and found the supplyed .hex file in the application folder. this was then transfered to the on-chip flash.
after the transfere was completed, the bootloader then preformed a systemReset, now validating that the transfered files checksum was valid, and thereby enabeling the bootloader to access the inline assembly code. at this point is the program freezing.

by using the debug functionality of the IDE, could i step through the program until it reaches the inline assembly code, which resoults in the program jumping to the Hardfault_Handler and giving me the error message included in the img of my original post.

0 Kudos

1,439 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Thomas Havregaard Soerensen,

Let me introduce the sequence of testing on my site.

As mentioned before, I only have the MCB1114 board (Fig 1), so I create the simple demo which triggers the LEDs flashing every time when enters Systick interrupt function.

According to your statement, I encounter a weird issue, the HyperTerminal can't receive the 'C' character and target board doesn't response anything to the PC when send the bin file either.

But I have another way to implement it, using the IDE to program the bootloader and application code to the assigned area of the Flash.

When I debug the bootlaoder demo in the LPCXpresso IDE, I found that the bootloader demo can jump the application successful and in the Fig 2, you would see that when an Systick interrupt occurs the CPU gets the address of the interrupt handler from the vector table located in sector 0, and the addresses contained in this table point to a series of re-direct function.
So I think the bootlaoder code is good during the testing, and I've also attached the application demo I created.

WeChat Image_20170519151822.jpg

                                                                  Fig 1

2017-05-19_15-20-53.jpg

                                                                Fig 2
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos