-
Notifications
You must be signed in to change notification settings - Fork 3
Compilation
Basically, you need WinAVR (I'm using WinAVR-20100110). A MinGW or GnuWin32 environment makes things easier. Visual Studio is not necessary; I use it as IDE (been using that since 1994 in all versions, so I'm using it where I can), but that's not the important thing. The compiler used is WinAVR, and to generate it, I use a batch file which sets up the compiler (WinAVR) and environment (MinGW or GnuWin32, since the tool set that comes with WinAVR is too dumb) and then calls make.
In Visual Studio, I call WinAVRMake.bat:
@echo off
setlocal
REM --- A little batch file to set up paths before make is called
REM --- To be executed from within Visual Studio for WinAVR makefile builds
REM --- Setup complete GNU environment
REM --- comment out the next 2 lines if that's not available
call MinGW
set BASH_AVAILABLE=1
REM --- Set up WinAVR
call WinAVR
if not (%BASH_AVAILABLE%)==() bash -c "make %1 %2 %3 %4 %5 %6 %7 %8 %9 2>&1 | sed -e 's/\(\w\+\):\([0-9]\+\):/\1(\2):/'"
if (%BASH_AVAILABLE%)==() make %1 %2 %3 %4 %5 %6 %7 %8 %9 | sed -e 's/\(\w\+\):\([0-9]\+\):/\1(\2):/'
endlocal
which calls WinAVR.bat:
@echo off
if not (%WINAVR_BASE%)==() goto winavrdone
set WINAVR_BASE=D:\WinAVR-20100110
REM -- find out whether external GNU utilities have been set up already
set | %WINAVR_BASE%\utils\bin\grep -i mingw >nul
if not errorlevel 1 goto withmingw
set | %WINAVR_BASE%\utils\bin\grep -i gnuwin32 >nul
if not errorlevel 1 goto withgnuwin32
goto nognu
:withmingw
echo Using MinGW Utilities
goto setwinavr
:withgnuwin32
echo Using GNUWin32 Utilities
goto setwinavr
:nognu
echo Using WinAVR Utilities
PATH %WINAVR_BASE%\utils\bin;%PATH%
goto setwinavr
:setwinavr
PATH %WINAVR_BASE%\bin;%PATH%
:winavrdone
echo WinAVR environment set up.
and then mangles returned warnings and errors so that I can double-click on an error in Visual Studio to go to the offending source line.
My default environment is MinGW, which is set up by MinGW.bat:
@path %PATH%;D:\MinGW\msys\1.0\local\bin;D:\MinGW\bin;D:\MinGW\msys\1.0\bin;
@echo MinGW environment set up
which is called in WinAVRMake.bat. Alternatively, you can use GnuWin32, which I also have a GnuWin32.bat for:
@echo off
pushd d:\gnuwin32\bin
call set_gnuwin32 %1 %2 %3 %4 %5 %6 %7 %8 %9
popd
set HOME=%HOMEDRIVE%%HOMEPATH%
echo GnuWin32 environment set up
... not very sophisticated, but sufficient to get it done in Visual Studio.
But, as said, this is all just to make things easier - what you really, absolutely need is WinAVR (or the corresponding avr-gcc for Linux, if you're in that camp).
The rest of the work is done by the make file, where you can select a configuration to be built. The following configurations are built in:
- TEENSY_2 generates a binary for the Teensy 2
- PRO_MICRO generates a binary for the Pro Micro (cheapest ATmega32U4 board you can get)
- ADAFRUIT generates a binary for the Adafruit ATmega32U4 breakout board
- TEENSYPP_1 generates a binary for the Teensy++ 1.0
- TEENSYPP_2 generates a binary for the Teensy++ 2.0
You can select one of them by passing it as a variable to make, like
make LAYOUT=TEENSY_2
(TEENSY_2 is the default, by the way). If you want to (re)generate all possible binaries, invoke it as
make allconfigs
In my build system, you'd have to...
- define a new layout type in the makefile (and optionally add it to the allconfigs target)
- set the specific layout for this hardware board (LEDs, port assignments
etc.) in
hwdefs.h - use it, like in
make LAYOUT=YourNewLayout
- Home
- Compilation
- Design
- New Features
- Controller System - The Controller is based on a matrix, rather than the PS/2 pins.