Serious Bug(s) in Kinetis Example Code!! Warning!

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

Serious Bug(s) in Kinetis Example Code!! Warning!

2,134 Views
emh203
Contributor II
Beware! http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K40&nodeId=01624698C9&fpsp=1&tab=Desi... CW_MCU_V10_1_EXAMPLES: CodeWarrior MCU 10.1 Software Examples.. Size (K): 6832 Format: zip Rev #: 10.1 Modified: 6/7/2011 There is a bug in the silicon for all of the kinetis chips. (Errata e2448). All of the example programs I tried with the K60 board I have hang in the PLL_init() function. Whoever ported these from the IAR version forgot to implement this workaround: https://community.freescale.com/thread/79526 I filed a support case. 1-764919891
0 Kudos
6 Replies

811 Views
emh203
Contributor II

Here is the work around.    I tested it with 2 of the projects.

 

1.)   Modify the linker command file to add this:
_ROMCodeToCopy = ___ROM_AT + SIZEOF(.app_data); 
.copyToRAM: AT(_ROMCodeToCopy) { 
. = ALIGN (0x4); 
__START_COPYTORAM = .; 
*(CopyToRAM) 
__END_COPYTORAM = .; 
} >> m_data
2.)  You have to add some pragmas around code you want to execute from ram (as code warrior does not support the __ramfunc keyword like IAR).    The set_sys_dividers in the MCG.c file needs to run from ram.
#pragma section CopyToRAM begin
void set_sys_dividers(uint32 outdiv1, uint32 outdiv2, uint32 outdiv3, uint32 outdiv4)
{
..
...
..

}

 

#pragma section CopyToRAM end

0 Kudos

811 Views
emh203
Contributor II

BTW:  This fixed applies to projects that execute from the FLASH.

0 Kudos

811 Views
jimtrudeau
Senior Contributor I

Just following up - we do pay attention! In the abence of any specifics, we tested them all and haven't been able to replicate the problem, running in both RAM and flash. We're still trying to nail down if this is a replicatable problem, but so far, have not been successful duplicating this.

 

We genuinely appreciate reports like this. THis is why forums are so cool - if there are problems, you help us find them. Even if it turns out to be a false alarm, that's OK. Sometimes that smell of smoke turns out to be a real fire. It definitely pays to check.

0 Kudos

811 Views
emh203
Contributor II

Sorry Jim,   I just saw this. 

 

I noticed that the exmaple programs now seem to have a __relocate_code__ macro to handle e2448.

 

Let me check everything again.

 

Its wierd,  not all chips exhibit e2448.....

 

 

0 Kudos

811 Views
emh203
Contributor II

Jim:

 

Also could you have your apps guy look into the linker files?   Here is the issue:

 

in the KINETIS_SC examples, there are a bunch of linker files for the example code.   But these linker files are alot different from the ones used when you create a "bare bones" project in code warrior, often making code porting difficult if the have to work around e2448.

 

For example compare the 256KB_flash.lcf in the samples to what codewarrior by default generates.   Alot of the exmaple code needs the .relocate_code section but the default codewarrior linker file does not have this.   It would nice if these were all in agreement.

 

0 Kudos

811 Views
jimtrudeau
Senior Contributor I

Can you identify which particular examples you had the problem with? I'll point them out to the apps team and we'll test them and fix them if required. I sit about 50 meters from the apps manager. :smileyhappy: These were all tested on the CodeWarrior MCU 10.1 tools, so this should not be an issue. But... let's see what's happening.

 

 

0 Kudos