在head.s中,要保存數據段的起始位置,如下所示:
p1.l = __rambase;
p1.h = __rambase;
r0.l = __sdata;
r0.h = __sdata;
[p1] = r0;
在這裡,_sdata是在vmlinux.lds.s中定義的一個值,它指向數據段的首地址,如下所示:
.data :
{
/* make sure the init_task is aligned to the
* kernel thread size so we can locate the kernel
* stack properly and quickly.
*/
__sdata = .;
. = ALIGN(THREAD_SIZE);
*(.data.init_task)
. = ALIGN(32);
*(.data.cacheline_aligned)
DATA_DATA
*(.data.*)
CONSTRUCTORS
. = ALIGN(THREAD_SIZE);
__edata = .;
}
在VDSP向導生成的LDF文件中,也需要使用數據段,不過它是把代碼和數據混合放在一起的:
sdram
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJECTS_CORE_A(sdram_bank0) $LIBRARIES_CORE_A(sdram_bank0))
/*$VDSG<insert-input-sections-at-the-start-of-sdram-A> */
/* Text inserted between these $VDSG comments will be preserved */
/*$VDSG<insert-input-sections-at-the-start-of-sdram-A> */
INPUT_SECTIONS($OBJECTS_CORE_A(VDK_ISR_code) $LIBRARIES_CORE_A(VDK_ISR_code))
INPUT_SECTIONS($OBJECTS_CORE_A(program) $LIBRARIES_CORE_A(program))
INPUT_SECTIONS($OBJECTS_CORE_A(noncache_code) $LIBRARIES_CORE_A(noncache_code))
INPUT_SECTIONS($OBJECTS_CORE_A(sdram_data) $LIBRARIES_CORE_A(sdram_data))
INPUT_SECTIONS($OBJECTS_CORE_A(data1) $LIBRARIES_CORE_A(data1))
INPUT_SECTIONS($OBJECTS_CORE_A(voldata) $LIBRARIES_CORE_A(voldata))
INPUT_SECTIONS($OBJECTS_CORE_A(constdata) $LIBRARIES_CORE_A(constdata))
/*$VDSG<insert-input-sections-at-the-end-of-sdram-A> */
/* Text inserted between these $VDSG comments will be preserved */
/*$VDSG<insert-input-sections-at-the-end-of-sdram-A> */
} > MEM_SDRAM
因此我們需要將之拆開分成兩個段:
sdram
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJECTS_CORE_A(sdram_bank0) $LIBRARIES_CORE_A(sdram_bank0))
/*$VDSG<insert-input-sections-at-the-start-of-sdram-A> */
/* Text inserted between these $VDSG comments will be preserved */
/*$VDSG<insert-input-sections-at-the-start-of-sdram-A> */
INPUT_SECTIONS($OBJECTS_CORE_A(VDK_ISR_code) $LIBRARIES_CORE_A(VDK_ISR_code))
INPUT_SECTIONS($OBJECTS_CORE_A(program) $LIBRARIES_CORE_A(program))
INPUT_SECTIONS($OBJECTS_CORE_A(noncache_code) $LIBRARIES_CORE_A(noncache_code))
/*$VDSG<insert-input-sections-at-the-end-of-sdram-A> */
/* Text inserted between these $VDSG comments will be preserved */
/*$VDSG<insert-input-sections-at-the-end-of-sdram-A> */
} > MEM_SDRAM
.data
{
/* make sure the init_task is aligned to the
* kernel thread size so we can locate the kernel
* stack properly and quickly.
*/
__sdata = .;
INPUT_SECTION_ALIGN(8192)
INPUT_SECTIONS($LIBRARIES_CORE_A(.data.init_task))
INPUT_SECTION_ALIGN(32)
INPUT_SECTIONS($LIBRARIES_CORE_A(.data.cacheline_aligned))
INPUT_SECTIONS($OBJECTS_CORE_A(sdram_data) $LIBRARIES_CORE_A(sdram_data))
INPUT_SECTIONS($OBJECTS_CORE_A(data1) $LIBRARIES_CORE_A(data1))
INPUT_SECTIONS($OBJECTS_CORE_A(voldata) $LIBRARIES_CORE_A(voldata))
INPUT_SECTIONS($OBJECTS_CORE_A(constdata) $LIBRARIES_CORE_A(constdata))
INPUT_SECTIONS($OBJECTS_CORE_A(.data.*))
. = (. + 8191) / 8192 * 8192;
__edata = .;
} > MEM_SDRAM
在這裡直接將THREAD_SIZE替換為8192,避免在LDF中包含頭文件時可能造成的問題。
uclinux-2008R1-RC8(bf561)到VDSP5的移植(62)
uclinux-2008R1-RC8(bf561)到VDSP5的移植(60):current_text_addr
uclinux-2008R1-RC8(bf561)到VDSP5的移植(58)
uclinux-2008R1-RC8(bf561)到VDSP5的移植(57)
uclinux-2008R1-RC8(bf561)到VDSP5的移植(56):__grab_cache_page
uclinux-2008R1-RC8(bf561)到VDSP5的移植(46):raw_rwlock_t