FlashForth: Compile a New Version
Where I describe in detail how to compile a new version of FlashForth.
Its helpful to be able to compile a new version of FlashForth. A simple reason is to increase the baudrate from 38400 to 250000, increasing your productivity. It isn’t difficult, however the tool chain can be a bit complex.
You will need to install both the MPLAB IDE and the XC8 compiler for this exercise. You will also need a hardware programmer such as the Atmel ICE or Microchip SNAP.
Once you have done both the application and programmer, follow these instructions. They are specific to macOS, however, Linux and Windows will be quite similar.
MPLAB X Compilation
1. In terminal:
cd Documents/flashforth cp -r avr/FF-ATMEGA.X/ ~/Desktop/FF-ATMEGA.X/ cp -r avr/src/ ~/Desktop/FF-ATMEGA.X/src
I do this to keep the flashforth folder clean, so that I can easily update the folder when the overall FlashForth source is updated.
2. Connect both Uno and Atmel ICE to Mac
In my case, I’m using the Atmel ICE to program the Uno. The SNAP will work as well. You might also be able to use another UNO, using the second UNO as an in-circuit-programmer.
3. Open MPLAB X
Follow the following steps in MPLAB IDE:
- File -> New Project -> Standalone Project
- Device: 328P and Tool: Atmel ICE…
- Choose XC8 as your compiler
- Browse to Desktop and make the Project Folder FF-ATMEGA.X
- Set Project Name: FF and Set as main project (Creates FF.X folder which becomes the main folder)
- In the Projects column on the left, right-click on Source Files and add Existing Item ../src/ff-xc8.asm
- Put the following text in Production -> Set Project Configuration -> Customize -> XC8 Global Options -> Additional Options then click Apply and OK
4. In your editor
Convert all <.inc> references to “.inc” (include quotes on change)
# in Sublime Text, Shift-Cmd-F and (<)(.*)(\.inc)(>) "$2$3" # Made 3 replacements
Change the following line 41
# original line #define BAUDRATE0 38400 # new line #define BAUDRATE0 250000
5. In terminal
cd ~/Desktop/FF-ATMEGA.X/FF.X make clean all MP_PROCESSOR_OPTION=ATmega328 OPERATOR_UART=0 cp dist/default/production/FF.X.production.hex ~/Desktop/FF.hex cd ~/Desktop avrdude -p m328p -P usb -c atmelice_isp -e -u -U flash:w:FF.hex :i -U efuse:w:0xff:m -U hfuse:w:0xda:m -U lfuse:w:0xff:m
The last step will use avrdude to copy the new .hex file from your system to the Uno. Open you serial application and see if it works!
Comments powered by Talkyard.