mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-15 11:08:09 +08:00
module developing
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@663 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
+8
-2
@@ -255,9 +255,15 @@ struct rt_module* rt_module_load(void* module_ptr, const rt_uint8_t* name)
|
||||
if (IS_PROG(shdr[index]) && IS_AW(shdr[index]))
|
||||
{
|
||||
module->module_data = (rt_uint32_t)ptr;
|
||||
rt_memset(ptr, 0, shdr[index].sh_size);
|
||||
rt_memcpy(ptr, (rt_uint8_t*)elf_module + shdr[index].sh_offset, shdr[index].sh_size);
|
||||
ptr += shdr[index].sh_size;
|
||||
}
|
||||
|
||||
/* load bss section */
|
||||
if (IS_NOPROG(shdr[index]) && IS_AW(shdr[index]))
|
||||
{
|
||||
rt_memset(ptr, 0, shdr[index].sh_size);
|
||||
}
|
||||
}
|
||||
|
||||
/* set module entry */
|
||||
@@ -316,7 +322,7 @@ struct rt_module* rt_module_load(void* module_ptr, const rt_uint8_t* name)
|
||||
{
|
||||
/* relocate object in data section */
|
||||
rt_module_arm_relocate(module, rel,
|
||||
(Elf32_Addr)(ptr + sym->st_value),
|
||||
(Elf32_Addr)(module->module_data + sym->st_value),
|
||||
module_addr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user