问题

对于EFM8SB1,实例中定义了如下代码的理由是什么?

 

SI_LOCATED_VARIABLE_NO_INIT (reserved, uint8_t, SI_SEG_XDATA, 0x0000);

答案

该保留变量确保程序中不使用XDATA RAM外部数据存储器的第一个字节,以应对EFM8SB1器件存在的问题。

 

参照EFM8SB1 参考手册,第2.3章节:

"Note: On device reset or upon waking up from Sleep mode, address 0x0000 of external memory (XRAM) may be overwritten by an indeterminate value. The indeterminate value is 0x00 in most situations. A dummy variable should be placed at address 0x0000 in external memory to ensure that the application firmware does not store any data that needs to be retained through reset or Sleep at this memory location."

  • 8-bit MCUs
  • Knowledge Base Articles