Login

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.

ARM Community: Keil RTX and bootloading - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Keil RTX and bootloading Rate Topic: -----

#1 User is offline   JohanNetstar 

  • Member
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 07-August 08

Posted 25 January 2011 - 08:32 AM

Hi all.

I've recently written a secondary bootloader for NXP LPC17xx devices. The design is relatively simple: All our products have embedded serial flash connected with an SPI bus to the micro. The user application is responsible to load a binary image onto the serial flash. When the bootloader starts, it checks the serial flash for a binary image. If one is not found, it jumps to the user application. If one is found, it verifies the integrity of the image by doing a CRC check. If the check passes it begins to update the LPC's flash from the binary image on the serial flash.

I've confirmed that the bootloader application is working properly. Firstly I checked the LPC's flash with a ULINK Pro and made sure the bootloader is not accidentally overridden. Then I uploaded a small application that reads and verifies a large chunk of flash and blinks a led. All these tests succeeded and I'm confident my bootloader works properly.

The problem arises when I try to upload an application which uses the Keil RL-ARM real time OS. When I upload this type of application, nothing happens. I traced the problem with a ULINK and I found that the trace stops at SVC_Handler in startup_LPC17xx.s.

All our RL-ARM based applications run in privileged mode. I know the RTOS uses SVC to access hardware etc in privileged mode.

Is there something I should do in the bootloader in order to support RL apps?

This post has been edited by JohanNetstar: 25 January 2011 - 08:38 AM

0

#2 User is offline   Joseph Yiu 

  • Regular Contributor
  • PipPipPip
  • Group: Members.
  • Posts: 217
  • Joined: 01-March 10

Posted 25 January 2011 - 11:49 AM

Hi there,

The Keil RTX Kernel should contain the require SVC handler. For some unknown reasons, the SVC vector in your compiled image might be pointing to the dummy SVC handler in the startup code rather than the OS kernel. You might need to check your compile and linking options to see if anything can affect it.
The dummy SVC handler in the startup code should be declared as [WEAK], which mean it can be overridden by a real SVC handler is it is presented. You can also try remove the dummy SVC handler in the startup code to see if it can solve the problem.

Are you using the source code version or precompiled RTX kernel library?
If using the source version, make sure HAL_CM3.c is included in the project.
This contains the "SVC_Handler".

regards,
Joseph
0

#3 User is offline   JohanNetstar 

  • Member
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 07-August 08

Posted 25 January 2011 - 01:46 PM

I've found my problem:
in the file system_LPC17xx.c I found this:

// Set Vector table offset value
#if (__RAM_MODE__==1)
SCB->VTOR = 0x10000000 & 0x3FFFFF80;
#else
SCB->VTOR = 0x00000000 & 0x3FFFFF80;
#endif

this obviously sets the VTOR to the incorrect location. It's merely a coincidence that the application running priveledged mode had the above code and the one running unpriveledged mode did not have it.. SVC is the first IRQ in my RTX app
0

#4 User is offline   Jean Fernandes 

  • Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 20-August 11

Posted 21 August 2011 - 02:11 AM

Johan

I have a booloader running on 0x00000000 and another application starting 0x00002000, where the first read the external
flash and copy the firmware upgrade to 0x00002000 and jump the pc for it.

So What do I need modify on

startup_lpc17xx.s
core_cm3.h
system_lpc17xx.c
lpc17xx.h

In order to :

- Use the 0x00002000 application on normal and debug mode, avoiding undesired writes on bootloader region.
- Remap all vector address to run the application normally.

Should you explain, what the correct order of code execution before the PC go to the main ?

Regards.

Jean Fernandes
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic