- 论坛徽章:
- 0
|
简单说明一下情况,现在在做armulator下的ucosii的移植,arumlator模拟的sa。
从网上下载了ucosiiforskyeye的源代码,在此基础上进行了相应的更改。
现在遇到的问题是,整个工程可以编译链接,但是在运行的时候总运行不起来。准确地说,用arm-linux-gdb调试程序不知道跑到那里去了,但提示却说正常退出!晕!
下面是我的工程组织结构:
1.图
![]()
2.代码问及那
[root@localhost ea2]# ls arch/ebsa110/
sa110_init.c sa110_init.c.bak sa110_init.h sa110_init.h.bak start.S
[root@localhost ea2]# ls kernel/ucos/
CVS includes.h os_cfg.h os_core.c os_cpu_a.S os_cpu_c.c os_cpu.h os_mbox.c os_mem.c os_mutex.c os_q.c os_sem.c os_task.c os_time.c ucos_ii.h
[root@localhost ea2]# ls samples/
dir.make dir.make.bak rules.make rules.make.bak samples.lds ucos_test
[root@localhost ea2]# ls samples/ucos_test/
main_entry.c main_entry.c.bak makefile makefile.bak
在进入samples/ucos_test/中运行make dep,make 后,生成ucosii.elf文件。
下面是我的ld script的代码(删除了ucosiiforskyeye中的一些部分,在未删除之前,结果是一样的):
OUTPUT_ARCH(arm)
ENTRY(begin)
SECTIONS
{
. = 0xc0000000;
.text : { /* Real text segment */
_begin = .; /* Text and read-only data */
*(.text)
. = ALIGN(16);
*(.got) /* Global offset table */
_etext = .; /* End of text section */
}
. = ALIGN(8192);
.data : {
/*
* and the usual data section
*/
*(.data)
CONSTRUCTORS
_edata = .;
}
.bss : {
__bss_start = .; /* BSS */
*(.bss)
*(COMMON)
_end = . ;
}
. = ALIGN(8192);
_end_kernel = .;
}
其中的begin是arch/ebas110/start.S中定义的。部分start.S代码如下:
begin:
@set up irq stack
mov r0, #0xd2 @ make irq mode with all irqs disabled
msr cpsr, r0
ldr sp, =irq_stack @ set sp_irq = irq_stack
@set up svc stack
mov r0, #0xd3 @ make svc mode with all irqs disabled
msr cpsr, r0
ldr sp, =svc_stack @ set sp_svc = svc_stack
@ here irq enabled
mov r0, #0x13
msr cpsr, r0
b start_kernel @ jump to main_entry.c
.................
start_kernel在samples/ucos_test/main_entry.c中定义。部分main_entry.c代码如下:
void start_kernel(void)
{
int task_1 = 1;
int task_2 = 2;
printf("hello world!");
..........
调试过程及结果
(gdb) target sim
Host Name = localhost
connect: Connection refused
Connected to the simulator.
(gdb) load
Loading section .text, size 0x594c8 vma 0xc0000000
Loading section .data, size 0x30d8 vma 0xc005a000
Loading section .got.plt, size 0xc vma 0xc005d0d8
Loading section __libc_atexit, size 0x4 vma 0x24ac
Loading section __libc_subinit, size 0xc vma 0x24b0
Loading section __libc_subfreeres, size 0x3c vma 0x24bc
Start address 0xc0000000
Transfer rate: 3026880 bits in <1 sec.
(gdb) run
Starting program: /emsim-2.0/usr/src/linux-2.4.18-arm/ucosii.elf
PC = c00080f4, I/O read at fffffb44
Program exited normally.
-------------------------------------------------------
可以利用b start_kernel增加断点,但是运行结果是一样的。
所以,我认为程序是根本没有运行起来。
还望达人指教。(搞了很久了,没整通,特来发帖求助) |
|