在使用SMT32F4时想 使用CCMRAM的那64K空间
修改ld链接文件 如下,这个是rt-thread的链接文件,添加了CCMRAM
MEMORY
{
ROM (rx) : ORIGIN =0x08000000,LENGTH =1024k
RAM (rw) : ORIGIN =0x20000000,LENGTH =128k
CCMRAM (rwx) : ORIGIN =0x10000000,LENGTH =64k
}
SECTIONS
{
.........
_siccmram = LOADADDR(.ccmram);
/* CCM-RAM section
*
* IMPORTANT NOTE!
* If initialized variables will be placed in this section,
* the startup code needs to be modified to copy the init-values.
*/
.ccmram :
{
. = ALIGN(4);
_sccmram = .; /* create a global symbol at ccmram start */
*(.ccmram)
*(.ccmram*)
. = ALIGN(4);
_eccmram = .; /* create a global symbol at ccmram end */
} >CCMRAM
...........
}
使用 gcc编译链接,然后 生成elf 生成 bin
发现bin文件居然有 128M,猜想应该是CCMRAM地址有数据要初始化,bin文件是无地址
于是找到cubemx生成ld链接文件看看
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
}
SECTIONS
{
..........
_siccmram = LOADADDR(.ccmram);
/* CCM-RAM section
*
* IMPORTANT NOTE!
* If initialized variables will be placed in this section,
* the startup code needs to be modified to copy the init-values.
*/
.ccmram :
{
. = ALIGN(4);
_sccmram = .; /* create a global symbol at ccmram start */
*(.ccmram)
*(.ccmram*)
. = ALIGN(4);
_eccmram = .; /* create a global symbol at ccmram end */
} >CCMRAM AT> FLASH
..........
}
没多大区别
最后只要加个(NOLOAD) 不加载数据到CCMRAM就行了
MEMORY
{
ROM (rx) : ORIGIN =0x08000000,LENGTH =1024k
RAM (rw) : ORIGIN =0x20000000,LENGTH =128k
CCMRAM (rwx) : ORIGIN =0x10000000,LENGTH =64k
}
SECTIONS
{
.........
_siccmram = LOADADDR(.ccmram);
/* CCM-RAM section
*
* IMPORTANT NOTE!
* If initialized variables will be placed in this section,
* the startup code needs to be modified to copy the init-values.
*/
.ccmram (NOLOAD) :
{
. = ALIGN(4);
_sccmram = .; /* create a global symbol at ccmram start */
*(.ccmram)
*(.ccmram*)
. = ALIGN(4);
_eccmram = .; /* create a global symbol at ccmram end */
} >CCMRAM
...........
}