From: Ian J. <ij...@sa...> - 2009-05-05 05:47:35
|
Hello everyone. I'm still working on getting amforth and the butterfly application working for my environment. I have to go off-line for a few weeks at least. I posted two questions to the list so far and got some good solutions. I have also found some minor problems. Others might get some value from this so I will try to summarize. This has taken me some time but mostly because I am not familiar with atmel products nor forth. Thanks to Matthius, Erich, and Michael for their help. Platform: I'm running on host platform Free BSD 6.3 the AMD64 release. I'm currently using Avra 1.2.3, avrdude, svn 1.6x, gmake, an STK500 via serial port. Open issues: - tx0 is still referred to in lib\multitask.frt and appl\avr-butterfly \blocks\lcd.frt - lcd.frt is not currently working for me even using simply lcdemit - parsing ( ) style comments is problematic - easy workaround is to strip comments before/while uploading - currently I am not able to use amforth-upload.py though in the past this was working for me - no time to debug First Successes: - Avra 1.2.3 will build amforth 3.4.x for atmega169 from source with some simple modifications. - Updates to amforth-shell.py allow reliable serial uploads of forth code. - The ADC module is currently working with a few modifications. Avra Changes: - The FreeBSD "ports" version of avra is/was an old version. I rebuilt from source the 1.2.3 version in the usual way. - Avra needs the atmega169.inc file from the studio. I think for other processors you could manually edit such a file or convert the xml file to create all the defines. For me this looks like a couple of hours of work. - Avra also needs a device ATmega169 added to the device.c file in the device_list structure. I added the following: { "ATmega169", 8192, 0x100, 1024, 512, DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ELPM|DF_NO_ESPM}, again I think this should be relatively simple for most other processors - The old style include files have slightly different definitions. One source change that was needed in the bf.asm file was: ; IGJ - comment out new style value ; .equ amforth_interpreter = NRWW_START_ADDR ; IGJ attempted hack for older assembler .equ amforth_interpreter = LARGEBOOTSTART There is a better way to do this I'm sure. Forth Changes: Avra 1.2.3 will fail with overlapping code segment errors however my 1.0x version of Avra with the same modifications as above will work with 3.4. Matthius checked in some changes that I believe are simple commenting out of a couple of offending (to Avra) lines. There are a number of dependancies not noted in the code. I didn't know to look out for these. For the ADC module I noted the following: In dict_appl.inc we need set-current.asm to support marker. .include "words/set-current.asm" ; for marker In adc.frt I noted: \ adc routines \ IGJ 2009-05-04 a few comments \ needs atmega169.frt from library/devices \ needs bitnames.frt from library \ needs marker.frt from ANS library To use bitnames there was a minor problem: Bitnames needed minor mods to upload/compile in amforth: : bitmask: create ( C: "ccc" portadr n -- ) ( R: -- pinmask portadr ) must become: : bitmask: create \ ( C: "ccc" portadr n -- ) ( R: -- pinmask portadr ) possibly there is some change between the parser in 3.x and earlier versions? In adc.frt a similar looking problem for parsing lines beginning with () style comments, the value of the first term on each row is corrupted with the current form in 3.4. create bf_temps \ temperature list from -15 celsius to +60, taken directly from atmels sources ( -15 ) 923 , 917 , 911 , 904 , 898 , ( -10 ) 891 , 883 , 876 , 868 , 860 , ( -5 ) 851 , 843 , 834 , 825 , 815 , Moved the () comments to EOL i.e. ( -15 ) 923 , 917 , 911 , 904 , 898 , becomes 923 , 917 , 911 , 904 , 898 , ( -15 ) Reloaded and this corrects the table. Temperature reads to reasonable level. amforth-shell.py changes: Michael suggested moving usart routines to polling which has had success with in amforth 2.9. I was not feeling all that comfortable to do this. I think xon/off or character by character pacing might be a better long term approach. For now I just slow things down. Serial uploads became reliable after I added a 0.3 second sleep in the send_line method in python. Possibly 0.2 seconds is enough. I did limited experimentation. def send_line(f,line): global debug # interactive prompt: 'okr\n> ' # compiling prompt: 'ok' # error prompt: ' ?? ' f.send(line) # take it easy and sleep a bit time.sleep(0.3) print "+", sys.stdout.flush() # don't want to wait for progress indicator # get response r = f.expect(['ok', 'ok\r\n> ', ' \?\? ', fdpexpect.TIMEOUT, OK that's it for now. Ian |