This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

msp430F5438A 读写 flash

Other Parts Discussed in Thread: MSP430F5438A

如题:msp430F5438A的Code Flash 分四个bank, 但是怎么读取 BankC呢?

                            Bank D:  03FFFFh–030000h            64KB      
                            Bank C:  02FFFFh–020000h
                            Bank B:  01FFFFh–010000h
                            Bank A:  045BFFh–040000h     00FFFFh–005C00h

unsigned long * Flash_ptr  = ( unsigned long *)0x020000;      // Initialize Flash pointer

上面语句读写 code Flash 地址 0x020000 失败,单步调试发现实际读的地址是 0x0000。

但是用上面的方式读取  Info Flash 、RAM、BSL都没有问题,读写正常。 是不是code Flash 有其他的操作? 网上找的都是读写 info Flash

  • 楼主可以参考下这个资料:http://wenku.baidu.com/link?url=LAgnVsDy9qODOZP95Ftf93CqIJAQuB2XD-SqwxCeS5IFySa9XFLZq4s_EG3CYXAcNLYJvaS5L2BaAHJKTtz95_bU5jT09LL4uoucFWc-Jmu

  • 找到原因了

    是IAR编译器的问题,在选项中有个 Date Model选项,small 和 medium 模式下指针只有2个字节,因此写个  (char *)0x020000 地址会被截取丢失最高字节。2个字节的指针正好是64K,在5438中除了了code flash 外都能访问。

    选择large 模式就行了,此时指针4字节,4G的访问空间。完全覆盖到code flash。