From: Erich W. <ew....@na...> - 2010-08-07 18:45:22
|
Hello, playing with an duemilanove board (atmega328p). I'm building this from files in amforth/releases/4.0/app/template not from the arduino directory. This setup is big enough to just work (tested on atmega32). So with the following changes to template.asm diff -wu template.asm ../../amforth/releases/4.0/appl/template/template.asm --- template.asm 2010-08-07 20:31:40.000000000 +0200 +++ ../../amforth/releases/4.0/appl/template/template.asm 2010-07-02 21:16:39.000000000 +0200 @@ -12,19 +12,12 @@ ; files include the *def.inc from atmel internally. .include "device.asm" -; fixes for atmega328p -.equ TXEN = TXEN0 -.equ UCSZ0 = UCSZ00 -.equ RXEN = RXEN0 -.equ RXCIE = RXCIE0 - - ; amforth needs two essential parameters ; cpu clock in hertz, 1MHz is factory default -.equ F_CPU = 16000000 +.equ F_CPU = 8000000 ; initial baud rate of terminal -.include "drivers/usart_0.asm" +.include "drivers/usart.asm" .equ BAUD = 9600 .equ USART_B_VALUE = (1<<TXEN) | (1<<RXEN) | (1<<RXCIE) .equ USART_C_VALUE = (3<<UCSZ0) and MCU=atmega328p in makefile, I can successfully build an amforth, upload it to the controller, and talk to it: > ok > ok > ver amforth 4.0 ATmega328P ok > words i@ (i!) i! e@ e! not s>d up! up@ >< cmove> unloop i sp! sp@ rp! rp@ +! rshift lshift 1- 1+ xor or and 2* 2/ invert um* um/mod m* + - log 2 d< d> 0> u> u< true 0 0< > < 0= = <> r@ >r r> rot drop over swap ?dup dup c@ c! ! @ execute exit -int +int show-wordlist +usart baud t x? tx rx? rx order get-order get-current environment? environment end-code code abort abort" [char] immediate recurse user constant vari able [ ] ; :noname : does> create ?do leave +loop loop do again until repeat while begin then else if literal int! applturnkey is Rdefer Edefer words s" ." .s u. dinvert d- d+ d2* init-user ee>ram ee-user tib d2/ cmove dnegate dabs d>s j * defer@ defer! icompare find sear ch-wordlist to value unused noop ver ?stack interpret depth rp0 sp sp0 cold pause quit place word /string source cscan parse 2swap >numb er number char refill accept cskip throw catch handler ' type count spaces space cr icount itype s, digit? ud/mod ud.r ud. . d. .r d.r s ign #> #s # <# hold hld within max min abs mod / negate u/mod */ /mod */mod turnkey bl hex decimal bin ['] , compile ( \ allot here edp dp /key key? key emit? emit pad #tib >in cell+ cells base state f_cpu ok HOWEVER, after trying to create a new word, it stops working: > : one 1 ; ?? -13 10 > 1 .s ?? -13 5 > .s ?? -13 3 > .s ?? -13 3 > 1 ok > . ok > depth ?? -13 6 This looks to me like the pointer to the wordlist has gone off into the wild. Comparing template.asm to arduino/duemilanove.asm does not show suspicious differences (see below). More ideas? Erich diff -wu template.asm ../../amforth/releases/4.0/appl/arduino/duemilanove.asm | less --- template.asm 2010-08-07 20:31:40.000000000 +0200 +++ ../../amforth/releases/4.0/appl/arduino/duemilanove.asm 2010-07-02 21:16:37.000000000 +0200 @@ -1,48 +1,23 @@ -; This is a template for an amforth project. -; -; The order of the entries (esp the include order) must not be -; changed since it is very important that the settings are in the -; right order -; -; first is to include the macros from the amforth -; directory .include "macros.asm" - -; include the amforth device definition file. These -; files include the *def.inc from atmel internally. .include "device.asm" -; fixes for atmega328p -.equ TXEN = TXEN0 -.equ UCSZ0 = UCSZ00 -.equ RXEN = RXEN0 -.equ RXCIE = RXCIE0 - + .equ HLDSIZE = $10 ; 16 bit cellsize with binary representation + .equ TIBSIZE = $64 ; 80 characters is one line... + .equ APPUSERSIZE = 0 ; size of application user area -; amforth needs two essential parameters -; cpu clock in hertz, 1MHz is factory default +; cpu clock in hertz .equ F_CPU = 16000000 - -; initial baud rate of terminal +; baud rate of terminal .include "drivers/usart_0.asm" .equ BAUD = 9600 -.equ USART_B_VALUE = (1<<TXEN) | (1<<RXEN) | (1<<RXCIE) -.equ USART_C_VALUE = (3<<UCSZ0) - - -.equ HLDSIZE = $10 ; 16 bit cellsize with binary representation -.equ TIBSIZE = $64 ; ANS94 needs at least 80 characters per line -.equ APPUSERSIZE = 0 ; size of application specific user area in bytes - -; addresses of various data segments -.set here = ramstart ; initial HERE at compile time, grows upward -.set rstackstart = RAMEND ; start address of return stack, grows downward -.set stackstart = RAMEND - 80 ; start address of data stack, grows downward -.equ amforth_interpreter = max_dict_addr ; the same value as NRWW_START_ADDR -; change only if you know what to you do -.equ NUMWORDLISTS = 8 ; number of word lists in the searh order, at least 8 +.equ USART_B_VALUE = (1<<TXEN0) | (1<<RXEN0) | (1<<RXCIE0) +.equ USART_C_VALUE = (1<<UCSZ01) | ( 1<<UCSZ00) -.equ want_fun = 0 ; in case of an error out print an additional line with an caret indicating the error position +.set here = ramstart ; start address of HERE, grows upward +.set rstackstart = RAMEND +.set stackstart = RAMEND - 80 +.set amforth_interpreter = max_dict_addr -; include the whole source tree. +.set NUMWORDLISTS = 8 +.equ want_fun = 0 .include "amforth.asm" |