CMSIS and EEPROM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

CMSIS and EEPROM

531 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by FrankAndersen on Thu Nov 17 02:14:10 MST 2011
What is the state of the EEPROM data, on a new LPC1788?

The CMSIS driver for EEPROM, gives a hardfault error when writing 64 bytes to page 63

When using IAR compiler, the EEPROM driver only works in MODE_8_BIT

Because of this:

#ifdef __IAR_SYSTEMS_ICC__
#if (mode == MODE_8_BIT)
        uint8_t *tmp = (uint8_t *)data;
#elif (mode == MODE_16_BIT)
        uint16_t *tmp = (uint16_t *)data;
#else
        uint32_t *tmp = (uint32_t *)data;
#endif
#endif

which made tmp an uint8_t at compile time.

Best regards
标签 (1)
0 项奖励
1 回复

404 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Marc Crandall on Tue Nov 22 12:02:27 MST 2011
This is a (another) bug in the CMSIS driver.

"mode" is a function parameter  #ifdef requires compile time knowledge of the variable.

You will have to do something like:

<code>
uint8_t *tmp8;
uint16_t *tmp16;
uint32_t *tmp32;

#ifdef __IAR_SYSTEMS_ICC__
if (mode == MODE_8_BIT)
        tmp8 = (uint8_t *)data;
else if (mode == MODE_16_BIT)
        tmp16 = (uint16_t *)data;
else
        tmp32 = (uint32_t *)data;
#endif
</code>


PLEASE: report this in the bug tracker; http://www.lpcware.com/ct_plus/filter
0 项奖励