CH579 Flash address mapping with RB_ROM_CODE_OFS

Hello!

What is a flash address map when RB_ROM_CODE_OFS bit is set? CodeFlash is moved 0x8000 bytes down, but is DataFlash addressing shifted same way (i.e. became 0x00036800-0x00036FFF)?

I need read and write access to DataFlash from my APP code, which run with RB_ROM_CODE_OFS bit set and it looks like read access to DataFlash actually return data from InfoFlash.

RB_ROM_CODE_OFS 是指code运行取地址的时候,会固定加上0x8000,这样你从0地址开始存放的代码,就要从32K的位置开始存放。
但是这个标志位不影响读配置和dataflash,他至少改变code运行取地址,dataflash还是可以使用EVT里面的flash例子参考。


I did some research and found the following:

If RB_ROM_CODE_OFS is set, all Flash addresses are moved 0x8000 bytes down, but only for CPU accesses, Flash controller still uses unmodified addressing for erase/write operations!

I.e:

0x00008000-0x0003E7FF became 0x00000000-0x000367FF (part of CodeFlash)

0x0003E800-0x0003EFFF became 0x00036800-0x00036FFF (DataFlash)

0x0003F000-0x0003FFFF became 0x00037000-0x00037FFF (SystemFlash)

0x00040000-0x000403FF became 0x00038000-0x000383FF (InfoFlash)

Actually, InfoFlash pages are repeated multiple times, so still readable at 0x00040000 area.

Hope that information will help other users.


只有登录才能回复,可以选择微信账号登录