I finally cracked and ebayed myself a serial programmer so I could turn  my 
arduino into a (am)forthduino. Since I had to download AVR  Studio anyway, I 
thought I'd try to use it to build amforth.  With much help from Karl Lunt's 
User Guide, I was successful.  Three days later, amforth 4.4 was released. This 
time I wrote a  detailed set of instructions which I pass on here in the hope 
that others will find them a useful way to get started. Reports of  errors or 
ambiguities  welcomed.

regards,

Neal.

How to build amforth-4.4 images for an arduino using AVR Studio 5.0

Assumptions:

- you have downloaded and installed AVR Studio 5.0
- you have downloaded and unpacked the source code for amforth-4.4
- you have an Arduino board to test this on
- you have a programmer board eg 'avrdude'

1. Start up AVR Studio.
2. select 'new project' then the 'avr assembler' template.
3. fill in the name: (eg: AMFORTH4p4_328P). The 'Location:' should be something 
like My Documents\AVRStudio. The 'Solution name:' should have filled itself in 
to match the 'name:'. Make sure that 'create directory for solution' is ticked, 
click 'OK'.
4. The 'Device Selection' dialogue opens. In this example I'm generating an 
image for an Arduino Duemilanove using an atmega328p. Select the device you are 
using and click 'OK'.
5. After a few seconds, an editor tab opens entitled AMFORTH4p4_328P.asm (or 
whaever you chose for your project name).
6. Open a file explorer window in the amforth source tree appl/arduino folder.
7. Open a second file explorer window in the 
AVRStudio/AMFORTH4p4_328P/AMFORTH4p4_328P folder. I'm going to refer to this as 
the 'project folder' (and I'm now assuming you can work out where to use the 
project name that you selected rather than AMFORTH4p4_328P). In the project 
folder should see a Debug folder and two files: AMFORTH4p4_328P.asm file and 
AMFORTH4p4_328P.avrasmproj.
8. locate the folder appl/arduino/words and copy it to the project folder (the 
folder contains a file named applturnkey.asm).
9. locate the file appl/arduino/dict_appl.inc and copy it to the project folder.
10. locate the file appl/arduino/dict_appl_core.inc and copy it to the project 
folder.
11. delete the file AMFORTH4p4_328P.asm from your project folder.
12. locate the file appl/arduino/duemilanove.asm (or the correct name for your 
target arduino) and copy it to the project folder; rename it to 
AMFORTH4p4_328P.asm
13. locate the folder core/devices/atmega328p (or whatever). Copy the 
device.asm 
and device.inc files to the project folder.
14. Check. The project folder should contain:

Debug/
words/applturnkey.asm
dict_appl.inc
device.inc
AMFORTH4p4_328P.avrasmproj
dict_appl_core.inc
AMFORTH4p4_328P.asm
device.asm

15. Go back to AVR Studio. A pop-up warns you that AMFORTH4p4_328P.asm was 
'modified outside of the source editor'. Click 'Yes' to reload it. You will see 
it reload in the editor window.
16. From the main menu, select project->AMFORTH4p4_328P properties. A tabbed 
dialogue box opens. Select 'Build'. Observe the set of tick-boxes for 
'Generated 
files'. Make sure all 4 of them are ticked. Select 'Toolchain'. Click on 
'General' (under AVR Assembler). Observe the box entitled 'Include Paths (-I)'. 
Click the green '+' icon. Untick 'relative path' Select '...' and browse to the 
folder that holds the amforth source code. Click on the folder named 'core' and 
click 'OK, then 'OK' again to add the path. The path should start with a drive 
letter (eg: c:\). If you wrongly use a relative path (eg: ../../) the build 
will 
fail.
17. From the main menu, select file->save all.
18. From the main menu, select build->solution.
19. After a few seconds, the output window at the bottom of AVR Studio should 
show that the build completed successfully. If you get an error, check that you 
have followed all of the instructions above.
20. The Debug/ folder contains an .eep (eeprom) and a .hex (flash) file, along 
with some other files.

Now, use your programmer to:

1. program the fuses correctly (refer to the table in appl/arduino/readme.txt)
2. program the .eep and .hex files

Finally, the moment of truth. Power-cycle the arduino, connect it to the USB, 
wait for your PC to recognise it then start up a terminal emulator connected to 
the virtual COM port associated with the USB (Please don't use the dreadful 
Hyperterm. Treat yourself to a free download of Tera Term).

Once you have gone through this process successfully, read the excellent 
amforth-userguide.pdf to learn what you just did, and to learn how to customise 
your build. Also, read the excellent TechnicalGuide to learn how to use amforth.

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Amforth-devel mailing list
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to