TCC89x的内存分布区域设置

本文介绍TCC89x平台中如何调整内存分配,包括NK和RAM区域的设置方法,以及解决NK超过33M限制的问题。
AI助手已提取文章相关产品:

//=====================================================================
//TITLE:
// TCC89x的内存分布区域设置
//AUTHOR:
// norains
//DATE:
// Friday 7-January-2011
//Environment:
// Visual Studio 2005
// TCC89x Magellan V1.9.1
//=====================================================================

对于TCC89x而言,如何正确设置内存分布区域是一件很重要的事情。当然,如果你开发的产品和官方的EVB一致,也不会超过官方的范围,那么你一切皆可安心,直接采用默认设置即可。但如果不是,那么你就必须要自己手动更改了。

TCC89x的内存设置在magellan.bib文件,而该文件在BSP包Magellan的Files文件夹之下。在讨论这个问题之前,我们先看看内存分配的大概领域,如图:



方框指的是每个范围领域的内容,如果方框为灰色,意味着这两个领域只有在XIP模式下才有效。而红色的字体,对应magellan.bib文件中相应的宏,表示需要需要设置的数值。从图中可以看出,需要设置的数值分为两个,一个是起始地址,另一个则是大小。

Telechips原厂的magellan.bib文件末尾给出了一种计算这些数值的方法,只不过这方法是针对从零开始的状况,对于我们只需要修改某些数值的使用者而言,无疑显得稍有繁琐。其实回过头来说,一般magellan.bib文件我们并不需要大的修改,最常见的是由于添加的组件太多,导致编译的NK比规定的范围要大,这时候才需要对magellan.bib文件进行修正。

结合我们的所给的例图,修改NK的大小很简单。NKSTART数值维持不动,我们只是将NKLEN扩大。而NKLEN增大以后,就会影响到RAMSTART和RAMLEN的取值,而这两个数值在原有的基础上修改也是很简单的事情。

对于新的RAMSTART,其计算方法如下:
RAMSTART(new) = NKSTART + NKLEN(new)

新的RAMLEN,计算方式也大同小异,如下:
RAMLEN(new) = DDRAWST - RAMSTART(new)

这里需要注意一个问题,就是NKLEN超过33M的话,虽然可以编译成功,但用FWDN烧录系统的时候,会出错,其信息如图:


从图中的信息告诉我们,Kernel空间不够,无法烧录NK.ROM!那是不是意味着我们的NK只能少于33M呢?当然不是。不过,为了支持超过33M的大小,我们必须修改相应的代码。

打开.\Magellan\Src\LIB\SOC\NAND_DRV\nand_drv_v7.c文件,找到NAND_HIDDEN_0_PAGESIZE宏,其源代码如下:
#define NAND_HIDDEN_0_PAGESIZE (33/*MB*/*1024*2) #define NAND_HIDDEN_1_PAGESIZE (3/*MB*/*1024*2) // for LOGO #define NAND_HIDDEN_2_PAGESIZE (2/*MB*/*1024*2) #define NAND_HIDDEN_3_PAGESIZE (3/*MB*/*1024*2)

聪明的读者可能已经想到,如果需要NK支持更大的容量,只需要更改NAND_HIDDEN_0_PAGESIZE宏即可。原来的大小是33,你可以选择36,甚至更多,只要能容得下你NK的大小即可。

您可能感兴趣的与本文相关内容

Program received signal SIGBUS, Bus error. 0x0000fffff7f3a1c0 in ?? () from /usr/lib64/libstdc++.so.6 xgdb> bt [ 34000070] #0 0x0000fffff7f3a1c0 in ?? () from /usr/lib64/libstdc++.so.6 [ bl 9402c8da] #1 0x0000fffff7e87e4c in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() () from /usr/lib64/libstdc++.so.6 Reading in symbols for /usr1/zWX279063/1.10.0/libdtcenter/gtest_1.10.0_dtcenter/src/gtest.cc...done. [ bl 97ee8576] #2 0x000000000265f97c in std::pair<std::string const, testing::styleCheckItem>::~pair (this=0x44e432d0, __in_chrg=<optimized out>) at /usr/include/c++/7.3.0/bits/stl_pair.h:198 [ bl 97fffff0] #3 0x000000000265f9a0 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::string const, testing::styleCheckItem> > >::destroy<std::pair<std::string const, testing::styleCheckItem> > (this=0x4758610 <testing::styleCheck::styleCheckData>, __p=0x44e432d0) at /usr/include/c++/7.3.0/ext/new_allocator.h:140 [ bl 940006b6] #4 0x000000000265deb4 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::string const, testing::styleCheckItem> > > >::destroy<std::pair<std::string const, testing::styleCheckItem> > (__a=..., __p=0x44e432d0) at /usr/include/c++/7.3.0/bits/alloc_traits.h:487 [ bl 94000b33] #5 0x000000000265b1d0 in std::_Rb_tree<std::string, std::pair<std::string const, testing::styleCheckItem>, std::_Select1st<std::pair<std::string const, testing::styleCheckItem> >, std::less<std::string>, std::allocator<std::pair<std::string const, testing::styleCheckItem> > >::_M_destroy_node (this=0x4758610 <testing::styleCheck::styleCheckData>, __p=0x44e432b0) at /usr/include/c++/7.3.0/bits/stl_tree.h:650 [ bl 940014b8] #6 0x0000000002655ec0 in std::_Rb_tree<std::string, std::pair<std::string const, testing::styleCheckItem>, std::_Select1st<std::pair<std::string const, testing::styleCheckItem> >, std::less<std::string>, std::allocator<std::pair<std::string const, testing::styleCheckItem> > >::_M_drop_node (this=0x4758610 <testing::styleCheck::styleCheckData>, __p=0x44e432b0) at /usr/include/c++/7.3.0/bits/stl_tree.h:658 [ bl 940015fc] #7 0x00000000026506b8 in std::_Rb_tree<std::string, std::pair<std::string const, testing::styleCheckItem>, std::_Select1st<std::pair<std::string const, testing::styleCheckItem> >, std::less<std::string>, std::allocator<std::pair<std::string const, testing::styleCheckItem> > >::_M_erase (this=0x4758610 <testing::styleCheck::styleCheckData>, __x=0x44e432b0) at /usr/include/c++/7.3.0/bits/stl_tree.h:1858 [ bl 97fffff5] #8 0x00000000026506a0 in std::_Rb_tree<std::string, std::pair<std::string const, testing::styleCheckItem>, std::_Select1st<std::pair<std::string const, testing::styleCheckItem> >, std::less<std::string>, std::allocator<std::pair<std::string const, testing::styleCheckItem> > >::_M_erase (this=0x4758610 <testing::styleCheck::styleCheckData>, __x=0x44e42940) at /usr/include/c++/7.3.0/bits/stl_tree.h:1856 [ bl 97fffff5] #9 0x00000000026506a0 in std::_Rb_tree<std::string, std::pair<std::string const, testing::styleCheckItem>, std::_Select1st<std::pair<std::string const, testing::styleCheckItem> >, std::less<std::string>, std::allocator<std::pair<std::string const, testing::styleCheckItem> > >::_M_erase (this=0x4758610 <testing::styleCheck::styleCheckData>, __x=0x44e463b0) at /usr/include/c++/7.3.0/bits/stl_tree.h:1856 [ bl 940018b0] #10 0x000000000264a3b4 in std::_Rb_tree<std::string, std::pair<std::string const, testing::styleCheckItem>, std::_Select1st<std::pair<std::string const, testing::styleCheckItem> >, std::less<std::string>, std::allocator<std::pair<std::string const, testing::styleCheckItem> > >::~_Rb_tree (this=0x4758610 <testing::styleCheck::styleCheckData>, __in_chrg=<optimized out>) at /usr/include/c++/7.3.0/bits/stl_tree.h:949 [ bl 97ff9d4a] #11 0x0000000002662e70 in std::map<std::string, testing::styleCheckItem, std::less<std::string>, std::allocator<std::pair<std::string const, testing::styleCheckItem> > >::~map (this=0x4758610 <testing::styleCheck::styleCheckData>, __in_chrg=<optimized out>) at /usr/include/c++/7.3.0/bits/stl_map.h:294 [ blr d63f0380] #12 0x0000fffff7b724d0 in ?? () from /usr/lib64/libc.so.6 [ bl 97ffff5a] #13 0x0000fffff7b7262c in exit () from /usr/lib64/libc.so.6 [ bl 94005175] #14 0x0000fffff7b5e040 in ?? () from /usr/lib64/libc.so.6 [ bl 97ffffb0] #15 0x0000fffff7b5e114 in __libc_start_main () from /usr/lib64/libc.so.6 [ bl 97fffd89] #16 0x0000000002201970 in _start () 解释以上gdb错误
最新发布
09-20
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值