From: Marcel D. <mde...@my...> - 2007-03-05 20:31:55
|
Hi Windows users, Assembling amForth 1.3 with AVRStudio under Windows Since I own a test board with an atmega32, all the following hints refer to this controller and its related source files. They should be usable to the other controllers too, by replacing 'mega32' files with 'megaxx' where applicable. As for the moment I have not tested any of them. Assembling original source files with AVRASM2 in Atmel AvrStudio 4.12 yields the following errors: (numbered 1. to 5.) 1. Invalid redifinition of 'RWWSRE' in atmega32.asm (line 16) 2. Invalid redifinition of 'UDR0' in atmega32.asm (line 22) These values are defined in m32def.inc in the first place (file comes with AVRStudio); Resolved by commenting out line 16 in atmega32.asm, by commenting out line 22 in atmega32.asm and by replacing UDR0 with UDR in uasrt.asm source file. (m32def.inc is a system file and must not be altered). A fix should replace UDR0 in atmega32.asm with a new definition (e.g. UDR_0) or replace UDR0 with UDR in amForth sources. References to UDR0 are in: atmega8.asm atmega16.asm atmega32.asm atmega168.frt usart.asm I replaced UDR0 by UDR (24feb07)! 3. Undefined label TWSIaddr in atmega32.asm (line 68) Resolved by changing TWSIaddr into TWIaddr in line 68 4. Overlapping of object code in cseg in usart.asm (line 10) 5. Overlapping of object code in cseg in usart.asm (line 12) Atmels assembler does not accept different code sequences for the same address range (imho this is bad practice anyway). Resolved by commenting out several lines in usart.asm (lines 6..14) like this: /* .set pc_ = pc .org URXCaddr rjmp usart0_rx_isr .org UDREaddr rjmp usart0_udre_isr .org pc_ */ and by modifying interrupt vectors in atmega32.asm: .org URXCaddr ; USART Receive Complete Interrupt Vector Address rjmp usart0_rx_isr .org UDREaddr ; USART Data Register Empty Interrupt Vector Address rjmp usart0_udre_isr I modestly think the interrrupt vectors belong in atmega32.asm rather than in usart.asm. The resulting code assembles with no error and runs on my test board. Note: in AvrStudio you must manually save any changed files before a new build! Corrections above yield the following values (e.a.): EQU URXCaddr 0000001a EQU UDREaddr 0000001c EQU RWWSRE 00000004 EQU UDR 0000000c EQU UDR0 00000000 ; These seem to be correct. Any feedback welcome! md 24feb07, 03mar07 -- derri |