CW6.2>MCF51JM128J How to declare constants in flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW6.2>MCF51JM128J How to declare constants in flash

1,724 Views
lloizaga
Contributor I
Hello,
I'm working with MCF51JM128 and I need to declare a constant byte in flash.

I try to do this in the same way they do with 8-bits in Codewarrior, using the follow line:

const unsigned char pp=2;

instead of placing "pp" in the flash memory the variable is located in RAM.

I'm doing wrong?

Thanks in advance!!
Lucas
Labels (1)
0 Kudos
3 Replies

332 Views
J2MEJediMaster
Specialist I
Try taking at look in this thread. It discusses how to locate a const in Flash.

---Tom
0 Kudos

332 Views
CrasyCat
Specialist III
Hello
 
I did create a project for MCF51JM128 and added definition of a constant as follows:
 
  const unsigned char pp=2;
This constant is allocated in flash in my application.
 
extract from .map file
# .text
  00000410 00000026 .text   main (main.c)
  00000436 00000002 .text   __initialize_hardware (startcf.c)
  00000438 00000002 .text   __initialize_system (startcf.c)
  0000043A 0000001C .text   __copy_rom_section (startcf.c)
  00000456 00000034 .text   __copy_rom_sections_to_ram (startcf.c)
  0000048A 00000004 .text   _ExitProcess (startcf.c)
  0000048E 0000006A .text   clear_mem (startcf.c)
  000004F8 0000009A .text   _startup (startcf.c)
  00000592 000001BC .text   mcf_exception_handler (exceptions.c)
  0000074E 00000020 .text   asm_exception_handler (exceptions.c)
  0000076E 0000000A .text   foo (foo.c)
  00000778 0000002C .text   exit (C_4i_CF_RegABI_MSL.a abort_exit_cf.o)
  000007A4 00000034 .text   __exit (C_4i_CF_RegABI_MSL.a abort_exit_cf.o)
  000007D8 0000001C .text   __call_static_initializers (C_4i_CF_RegABI_Runtime.a cf_staticinitia)
  000007F4 0000002C .text   __destroy_global_chain (C_4i_CF_RegABI_Runtime.a cf_staticinitia)
  00000820 00000001 .rodata pp (foo.c)
#>00000824          ___ROM_AT (linker command file)
#>00000824          ___DATA_ROM (linker command file)
I am using CodeWarrior MCU V6.2 and I created my project using the wizard.
Am I missing something?
 
CrasyCat
0 Kudos

332 Views
lloizaga
Contributor I
I have this problem with Freescale's OTG-MSD Demo FW, my Map looks:

00800118 00000001 .bss WhatYouWant (main.c)
0 Kudos