FLBPR in JK3

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

FLBPR in JK3

3,639 Views
cicero_ribeiro
Contributor I
Hi for All :smileyhappy:

I had used EEPROM emulator easy with QT/QY.
With the simple instruction:

volatile const char MyFLBPR[] @0xFFBE = {0xE1};

I enable the write to first page of flash.
But when I try to do it with JK3, it don´t work:

volatile const char MyFLBPR[] @0xFE09 = {0x62};

I get an error message if it´s placed in main.c:
L1112: The section has segment type NO_INIT (illegal)

and I have no error if placed at other .c file, but looking into debugger, at the 0xFE09 I have 0x00.

Creating a section in .prm don´t work too.
If I try to:
FLPBR = 0x62; // it´s declarated in 60hc908jk3.h

It return the error:
C1019: Incompatible type to previous declaration (found 'int', expected 'FLBPRSTR volatile')

What can I do about this ?

Thanks.
Labels (1)
0 Kudos
4 Replies

561 Views
CompilerGuru
NXP Employee
NXP Employee
The problem is that the FLBPR at 0xFE09 is already defined in MC68HC908JK3.c, so you define the same memory address twice.
The only reason why you do not see the error when your MyFLBPR definition is after MC68HC908JK3.c in the link order is that in the linker tab, the following two messages are explicitely disabled:
-WmsgSd1100 -WmsgSd1912

Otherwise you would get an error for this resource conflict too.

Solutions? Hmm. The simplest is to copy MC68HC908JK3.h and MC68HC908JK3.c to your source directory, and to patch them to not define/declare FLBPR.

Daniel
0 Kudos

561 Views
cicero_ribeiro
Contributor I
Hi Daniel, Thanks ...

I make a little mistake... (???)
I put the instruction

FLBPR = 0x62;

into main.h to define a byte to write at record of the firmware.

When I try to do it at main.c, into main (), for my surprise, it´s working very well....
I say 'for my surprise' because it´s writing at execution time into flash address... maibe 0xFE09 is not a flash....
I tried this because I see into AN2504D from freescale, an API writing at this address in this way.

Can you explain it to us ??

Thanks.
0 Kudos

561 Views
RockyRoad
Contributor III

You've basically found the answer. In the JK3, the FLBPR is a normal register that must be written from your code as it executes. While in the QT/QY, FLBPR is a flash location that must be programmed as part of programming your firmware.

In the JK3 spec: "The FLASH Block Protect Register is implemented as an 8-bit I/O register."

In the QT/QY spec: "The FLASH block protect register is implemented as a byte within the FLASH memory, and therefore can only be written during a programming sequence of the FLASH memory."

It is easy to miss. It has been known to trip up the best of us.

- Rocky

Message Edited by RockyRoad on 05-22-2006 02:11 PM

0 Kudos

561 Views
cicero_ribeiro
Contributor I
That´s it.
Thanks for your explanation RockyRoad.

:smileyhappy:
0 Kudos