ARM Technical Support Knowledge Articles


Applies to: C51 C Compiler


Information in this article applies to:


I'm using the Keil 8051 tools C and Assembly code for a project I'm designing. I need to create 2 separate code areas: one for code in EPROM and one for code in FLASH or EEPROM.

The code in the EPROM will be fixed and will never change.

The code in the FLASH/EEPROM will be downloaded from time to time to update the firmware.

The EPROM must call functions in the FLASH/EEPROM but not vice-versa.

What's the best way to go about this?


There are a number of good ways to do this. The following method is only one suggestion.

  1. You must create the BOOT program which resides at address 0000h. This program starts immediately after RESET.
  2. You must create an EXTernal program which the BOOT program jumps to. The EXT program will probably start at 8000h or 4000h or something like that.
  3. You must create a jump table in the BOOT program that the EXT program can use to access the BOOT's functions. You may also just use the fixed addresses of the BOOT's functions, but that's more difficult.
  4. You must create BOOT's functions that will be called by EXT in such a way that they don't mess up EXT's variable space. The easiest way to do that is to use the small model reentrant stack.

The above "rules" were used in this bootloader example which you may download from the Keil web site.

Refer to the ABSTRACT.TXT file for details about the implementation.

Article last edited on: 2005-09-22 12:33:29

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential