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 |