From: Robert L. <xu...@xu...> - 2010-01-05 05:14:54
|
Hello- Has anyone successfully gotten amforth working on an ATmega644P? I tried to do this today, and immediately ran afoul of the fact that avra (AVR assembler, on Linux) doesn't support the ATmega644P. I patched avra to recognize the '644P (patch below), and was able to build amforth. After uploading it to the device, I got an amforth prompt as expected, but creating a new word (e.g. : hello ." Hello world" cr ; ) caused the device to apparently hang. Still in search of problems, I took a closer look at core/devices/atmega644.asm, and noticed the number of interrupts listed there do not line up with the datasheet. I patched atmega644.asm (patch below), rebuilt, and uploaded to the device, with identical results. Can anyone suggest a course of action? I'm relatively new to Forth, so while my normal next step would be to delve into the amforth code, it would be a steep learning curve; I thought I'd try here first. My development device is a PDIP-40 ATmega644P, installed in an STK500 board with the crystal oscillator selected and a 10MHz crystal installed. My fuse bits are at the bottom of this email. Transcript: amforth 3.6 ATmega644P > : hello ." Hello World " cr ; (hangs) AVRA Patch: --- avra-1.2.3.orig/device.c 2007-06-25 14:43:10.000000000 -0700 +++ avra-1.2.3/device.c 2010-01-04 20:54:02.000000000 -0800 @@ -104,6 +104,7 @@ { "ATmega88", 4096, 0x100, 1024, 512, DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ELPM|DF_NO_ESPM}, { "ATmega168", 8192, 0x100, 1024, 512, DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ELPM|DF_NO_ESPM}, { "ATmega8515", 8192, 0x60, 512, 512, DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ELPM|DF_NO_ESPM}, + { "ATmega644P", 32768, 0x100, 4096, 2048, DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ESPM}, {NULL, 0, 0, 0, 0} }; atmega644.asm Patch: --- atmega644.asm 2010-01-04 21:06:12.000000000 -0800 +++ atmega644P.asm 2010-01-04 21:06:54.000000000 -0800 @@ -2,7 +2,7 @@ ; Built using part description XML file version 69 ; generated automatically .nolist - .include "m644def.inc" + .include "m644Pdef.inc" .list .equ ramstart = $100 @@ -43,7 +43,7 @@ rol zh .endmacro .equ intvecsize = 2 ; please verify; flash size: 65536 bytes -.equ INTVECTORS = 28 +.equ INTVECTORS = 31 .org $002 rcall isr ; External Interrupt Request 0 .org $004 @@ -98,7 +98,13 @@ rcall isr ; 2-wire Serial Interface .org $036 rcall isr ; Store Program Memory Read +.org $038 + rcall isr ; USART1, Rx Complete +.org $03A + rcall isr ; USART1 Data register Empty +.org $03C + rcall isr ; USART1, Tx Complete mcustring: - .dw 9 - .db "ATmega644",0 + .dw 10 + .db "ATmega644P" .set codestart=pc Fuses: # set the fuses according to your MCU LFUSE=0xFE HFUSE=0xDF # some MCU have this one, see write-fuses target below EFUSE=0xFF |
From: Erich W. <ew....@na...> - 2010-01-05 17:05:13
|
Hello Robert, > Has anyone successfully gotten amforth working on an ATmega644P? I > tried to do this today, and immediately ran afoul of the fact that > avra (AVR assembler, on Linux) doesn't support the ATmega644P. about a year ago, I experimented with atmega-644p controllers, too. This was with amforth 3.3 I did *not* patch avra. And if I remember correctly, the include files from AVRStudio are of a newer format, and avra didn't like them. So I went and installed wine and the assembler from avrstudio. Yapp, not the best solution, but it worked for the moment. This results in the following call to produce the hex files: wine ~/wine/AvrAssembler2/avrasm2.exe -I ~/Forth/amforth/releases/3.3/core \ -I . -fI -l main.lst -m main.map -e main.eep.hex main.asm So for the heck of it, I just grabbed a 644P and powered it up. The hex file loads and the controller does talk with me: > ver amforth 3.3 ATmega644P ok > .res free FLASH cells 25207 free RAM cells 3795 used EEPROM cells 42 used data stack cells 0 used return stack 10 free return stack 70 ok > : hi ." hello, world!" cr ; ok > hi hello, world! ok > So far so good. How did I make it work??? Hm. . wine + avrassembler2 I mentioned above. . Fuse bits: # external crystal at 11.0592 MHz LFUSE=0xee HFUSE=0x89 . there are 31 interrupts now, you found that. It is certainly possible to dig out the differences to the old version 3.3, however, it would take some time. I could obviously send you my files, if you are interested in "code archeaology" :-) I have not used the 644p any more yet. Cheers, Erich |
From: Robert L. <xu...@xu...> - 2010-01-05 20:57:06
|
Erich- Thank you for your response. My patch to AVRA was somewhat slapdash and as such, I tend to suspect that AVRA is doing something wrong. I'll try assembling with AVRStudio's assembler, see if that gets me anywhere. It's also possible (even likely) there was a change between 3.3 and 3.6 that is causing this. Would you mind sending me the template.asm and so forth you used to build 3.3? It would be educational, if nothing else. Thanks again. On Tue, Jan 5, 2010 at 9:03 AM, Erich Waelde <ew....@na...> wrote: > Hello Robert, > > > Has anyone successfully gotten amforth working on an ATmega644P? I > > tried to do this today, and immediately ran afoul of the fact that > > avra (AVR assembler, on Linux) doesn't support the ATmega644P. > > about a year ago, I experimented with atmega-644p controllers, too. > This was with amforth 3.3 > > I did *not* patch avra. And if I remember correctly, the include files > from AVRStudio are of a newer format, and avra didn't like them. So I went > and installed wine and the assembler from avrstudio. Yapp, not the > best solution, but it worked for the moment. > > This results in the following call to produce the hex files: > > wine ~/wine/AvrAssembler2/avrasm2.exe -I ~/Forth/amforth/releases/3.3/core > \ > -I . -fI -l main.lst -m main.map -e main.eep.hex main.asm > > So for the heck of it, I just grabbed a 644P and powered it up. > The hex file loads and the controller does talk with me: > > ver > amforth 3.3 ATmega644P ok > > .res > free FLASH cells 25207 > free RAM cells 3795 > used EEPROM cells 42 > used data stack cells 0 > used return stack 10 > free return stack 70 > ok > > : hi ." hello, world!" cr ; > ok > > hi > hello, world! > ok > > > > So far so good. How did I make it work??? Hm. > . wine + avrassembler2 I mentioned above. > . Fuse bits: > # external crystal at 11.0592 MHz > LFUSE=0xee > HFUSE=0x89 > . there are 31 interrupts now, you found that. > > It is certainly possible to dig out the differences to the old > version 3.3, however, it would take some time. > > I could obviously send you my files, if you are interested > in "code archeaology" :-) I have not used the 644p any more yet. > > Cheers, > Erich > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > |