Keil Logo

C51: SPLITTING CODE BETWEEN EPROM AND FLASH/EEPROM


Information in this article applies to:

  • C51 All Versions

QUESTION

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?

ANSWER

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.

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Thursday, September 22, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

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

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.