[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Simulavr-devel] avrtest vs simulavrxx
From: |
Joel Sherrill |
Subject: |
Re: [Simulavr-devel] avrtest vs simulavrxx |
Date: |
Fri, 8 May 2009 15:35:38 -0500 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
address@hidden wrote:
On Fri May 8 13:43 , Joel Sherrill sent:
I think I have tracked one down to this feature in
avrtest that (I think) is not in simulavrxx and
is probably the culprit
" -d Initialize SRAM from .data (for ELF program)\n"
This sets a flag which is used later only to do this:
/* Also copy in SRAM. */
if (flag_initialize_sram && vaddr >= DATA_VADDR)
memcpy(cpu_data + vaddr - DATA_VADDR,
cpu_flash + addr, filesz);
The avrtest crt0.S code doesn't appear to copy
initialized data into RAM.
crt0.S is avr assembly code that C programs execute before main?
Yes. It is attached.
Any thoughts on how to implement this in simulavrxx?
I'd expect it to look a lot like the code that initializes the flash.
Perhaps the question is how to generate avr code that uses it?
I think that with gnu tools the compilation stage could be left alone.
The startup code could be mostly eliminated.
I think it would just have to assign the stack pointer.
The linker script would need to be changed.
Josh is porting RTEMS to the AVR for the Google Summer of
Code and Eric is his mentor. I am helping with the RTEMS issues.
RTEMS has its own tool chain (similar to avr tools) but each
Board Support Package has its own assembly language initialization.
I am beginning to think that by using the start code and linker
script that were recommended for avrtest, I have created problems.
I should move to the ones from the regular tools or at least ensure
the avrtest provided one does the same things.
--
Michael Hennebry
address@hidden
"War is only a hobby."
---- Msg sent via CableONE.net MyMail - http://www.cableone.net
--
Joel Sherrill, Ph.D. Director of Research & Development
address@hidden On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
#define SPL 0x3d
#define SPH 0x3e
#define SREG 0x3f
#define RAMPZ 0x3b
#define RAMEND (64 * 1024)
.weak __stack
.set __stack, RAMEND - 1
.weak __heap_end
.set __heap_end, 0
.section .vectors,"ax",@progbits
.global __vectors
.func __vectors
__vectors:
__reset:
jmp __init
.endfunc
.section .init0,"ax",@progbits
.weak __init
; .func __init
__init:
.section .init2,"ax",@progbits
clr r1
out 0x3f, r1
ldi r28,lo8(__stack)
ldi r29,hi8(__stack)
out SPH, r29
out SPL, r28
/* Only for >64K devices with RAMPZ, replaces the default code
provided by libgcc.S which is only linked in if necessary. */
.section .init4,"ax",@progbits
.global __do_copy_data
__do_copy_data:
.global __do_clear_bss
__do_clear_bss:
#if 0
ldi r17, hi8(__data_end)
ldi r26, lo8(__data_start)
ldi r27, hi8(__data_start)
ldi r30, lo8(__data_load_start)
ldi r31, hi8(__data_load_start)
ldi r16, hh8(__data_load_start)
out RAMPZ, r16
0:
cpi r26, lo8(__data_end)
cpc r27, r17
breq 1f
elpm r0, Z+
st X+, r0
rjmp 0b
1:
#endif
.section .init9,"ax",@progbits
call main
jmp exit
; .endfunc
.global exit
.func exit
exit: out 0x2f, r0
.endfunc
.global abort
.func abort
abort: out 0x29, r0
.endfunc