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

Writing constant to ROM

Maybe this is a simple question, but I just couldn't figure it out. Can someone tell me how to place a constant variable into the specific ROM area? I would like to be able to set a constant value at a particualr ROM area and use a pointer to get it whenever I need it.

Cheers,
Tang

Parents
  • Why does Keil have this restriction? You can do this with Raisonance and I would like to have my code be compatible with both. For Raisonance you just use:
    at 0x803d code char my_char = 0x55;

    I don't need to have a variable name created, but I would like to be able to set a byte that configures the hardware. This is a hardware configuration byte that needs to be programmed when the program is loaded. If I understand correctly there is no way to add a single statement to the Keil C program for this function. I have to link an assembly language file to do that with Keil. Is that correct?

Reply
  • Why does Keil have this restriction? You can do this with Raisonance and I would like to have my code be compatible with both. For Raisonance you just use:
    at 0x803d code char my_char = 0x55;

    I don't need to have a variable name created, but I would like to be able to set a byte that configures the hardware. This is a hardware configuration byte that needs to be programmed when the program is loaded. If I understand correctly there is no way to add a single statement to the Keil C program for this function. I have to link an assembly language file to do that with Keil. Is that correct?

Children