This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to store program code in flash?

Hello. I'm am a postgraduate engineering student and I'm currently working on a project that requires more than the available 1000H of program space and need to use the flash memory to store the program. I can't make the program any smaller at the and as it is barely functional as it current is with the code I've needed to remove.

I've never needed to use the flash memory in the past nor taught (I'm mechatronics major not electronics) and the lecturer that is an expert in the microprocessors has recently left and has not been replaced yet. Where would I find a step by step guide how to do it?

I looked through the support page for examples

www.silabs.com/.../mcu_applications_appnotes.htm

I found the example and notes about Code Banking but this does not say how to direct program code to the flash memory to start with and the code banking does not help as I'm using C8051FX20 micro that only has one bank.

Found the information about programming the flash memory with the JTAG but this seem to be example how to allow an update of the program while the micro is running

Any advice would be much appreciated

Thanks

Michael Edmondson

Parents
  • I think the C8051FX20 and C8051F020 are the same because the datasheets are identical, just FX model is not listed

    The complier comes up with saying a limit of 1000H (I'm assuming it means Hex) code limit reached. Which works out to 4KB decimal limit that must be the SRAM that is refered to in the datasheet

    All the code works when has been split up and removed other sections. Happens when all the code is complied together and goes over the limit.

Reply
  • I think the C8051FX20 and C8051F020 are the same because the datasheets are identical, just FX model is not listed

    The complier comes up with saying a limit of 1000H (I'm assuming it means Hex) code limit reached. Which works out to 4KB decimal limit that must be the SRAM that is refered to in the datasheet

    All the code works when has been split up and removed other sections. Happens when all the code is complied together and goes over the limit.

Children
  • this is the print out from the complier

    Link in progress...
    C:\SiLabs\MCU\IDEfiles\C51\BIN\bl51.exe @H:\Control\Micro_Controllers\Code_devlopment\Backup_30_05_2007\BasicSMPS\Brainsmicro\cyglink.txt
    .

    BL51 BANKED LINKER/LOCATER V5.03 - SN: Cygnal_8051Fxxx
    COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2002
    H:\Control\Micro_Controllers\Code_devlopment\Backup_30_05_2007\BasicSMPS\Brainsmicro\main.obj TO H:\Control\Micro_Controllers\Code_devlopment\Backup_30_05_2007\BasicSMPS\Brainsmicro\main RS(256) PL(68) PW(78)

    *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?CHECKSENDEDINPUTES?MAIN

    *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?_SENDRESULT?MAIN

    *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?INIT_TIMER4?MAIN

    *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: INIT_TIMER2 MODULE: H:\CONTROL\MICRO_CONTROLLERS\CODE_DEVLOPMENT\BACKUP_30_05_2007\BASICSMPS\BRAINSMICRO\MAIN.OBJ (MAIN)

    >>
    *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: INIT_TIMER2 MODULE: H:\CONTROL\MICRO_CONTROLLERS\CODE_DEVLOPMENT\BACKUP_30_05_2007\BASICSMPS\BRAINSMICRO\MAIN.OBJ (MAIN)

    >> ADDRESS: 126FH

    ******************************************************************************
    * RESTRICTED VERSION WITH 1000H BYTE CODE SIZE LIMIT; USED: 12CFH BYTE (117%) *
    ******************************************************************************

    >>
    >>
    >>
    Program Size: data=125.2 xdata=147 code=4748
    LINK/LOCATE RUN COMPLETE. 5 WARNING(S), 0 ERROR(S)

    *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?CHECKSENDEDINPUTES?MAIN

    *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?_SENDRESULT?MAIN

    *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?INIT_TIMER4?MAIN

    *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: INIT_TIMER2 MODULE: H:\CONTROL\MICRO_CONTROLLERS\CODE_DEVLOPMENT\BACKUP_30_05_2007\BASICSMPS\BRAINSMICRO\MAIN.OBJ (MAIN)

    >>
    *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: INIT_TIMER2 MODULE: H:\CONTROL\MICRO_CONTROLLERS\CODE_DEVLOPMENT\BACKUP_30_05_2007\BASICSMPS\BRAINSMICRO\MAIN.OBJ (MAIN)

    >> ADDRESS: 126FH

    *** FATAL ERROR L250: CODE SIZE LIMIT IN RESTRICTED VERSION EXCEEDED MODULE: H:\CONTROL\MICRO_CONTROLLERS\CODE_DEVLOPMENT\BACKUP_30_05_2007\BASICSMPS\BRAINSMICRO\MAIN.OBJ (-----)

    >> LIMIT: 1000H BYTE

  • ******************************************************************************
    * RESTRICTED VERSION WITH 1000H BYTE CODE SIZE LIMIT; USED: 12CFH BYTE (117%) *
    ******************************************************************************
    

    The evaluation version has a limit of 0x1000 code bytes which you have exceeded.

    Banking is not going to help you, you need to a full version of the Keil tools.

  • Which works out to 4KB decimal limit that must be the SRAM that is refered to in the datasheet

    It is the same number, but this is a complete coincidence.

    The 4 kB SRAM of the SiLabs parts are XRAM, which cannot be used to store any code in the first place, since the 8051 can only execute code stored in code/program memory, not in any of the several kinds of data memory (data/idata/xdata).

    The 4 kB code size limitation you are running into are a restriction of the evaluation version of the Keil tools. You will need to purchase a full version of the Keil tools if your code is larger than that, or switch to a different toolset.

  • "Banking is not going to help you"

    The evaluation version doesn't even support banking anyhow:

    http://www.keil.com/forum/docs/thread9938.asp

  • "I think the C8051FX20 and C8051F020 are the same..."

    Are you sure you don't mean C8051F02x?

    If not, please post a link to the actual SiLabs page(s) that describe(s) these devices...

  • "works out to 4KB decimal limit that must be the SRAM that is refered to in the datasheet"

    No.

    As already noted, it is a limitation of the particular version of the Tools - it has nothing to do with any particular target chip.

    And it's a limit on Code size - not data.

    See: http://www.keil.com/demo/limits.asp

  • Ok Thanks

    The number is C8051FX20-TB and is writen on the devlopment board. And the datasheet is in the back of one the books for the devlopment board.

    Found another compilier, no way my institute will pay the $4500 kiel wants when I'm the only postgrad using embbed systems and 4KB is enough for the undersgrad projects.

  • If price is a problem, you might be interested in SDCC.

    http://sdcc.sourceforge.net/

  • Michael;
    Did you really get a $4500 quote for PK51 from Keil? I was under the impression that Keil was very aggressive for educational pricing. AM I that wrong?

    4KB is enough for the undersgrad projects.

    Apparently 4K is Not enough if your program exceeds 4K.
    Bradford

  • need keil c51 and c166 for cheap prices,$100. contact me gogainet@yahoo.com

  • Your only (legal) hope at that price is to get lucky on ebay - but even then you'll be bidding against people who understand the value of these things...