Skip to content

Commit 0a69038

Browse files
Added Windows configure script
Updated heading style in README Added Windows serial explanation to README
1 parent 65848d8 commit 0a69038

File tree

2 files changed

+123
-16
lines changed

2 files changed

+123
-16
lines changed

README.markdown

+28-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

2-
Arduino CMake
3-
=============
2+
# Arduino CMake
43

54
Arduino is a great development platform, which is easy to use. It has everything a beginner should need. The *Arduino IDE* simplifies a lot of things for the standard user, but if you are a professional programmer the IDE can feel simplistic and restrictive.
65

@@ -31,17 +30,15 @@ TODO:
3130
* Mac OS X
3231
* Test more complex configurations and error handling
3332

34-
Contents
35-
--------
33+
## Contents
3634

3735
1. Getting Started
3836
2. Setting up Arduino CMake
3937
3. Creating firmware images
4038
4. Creating libraries
4139
5. Windows Enviroment Setup
4240

43-
Getting Started
44-
----------------
41+
## Getting Started
4542

4643
The following instructions are for **\*nix** type systems, specifically this is a Linux example.
4744

@@ -118,8 +115,7 @@ For a more detailed explanation, please read on...
118115

119116

120117

121-
Setting up Arduino CMake
122-
------------------------
118+
## Setting up Arduino CMake
123119

124120
The first step in generating Arduino firmware is including the **Arduino CMake** module package. This easily done with:
125121

@@ -135,8 +131,7 @@ That will require an *Arduino SDK* version **0022** or newer. To ensure that the
135131
find_package(Arduino 22 REQUIRED)
136132

137133

138-
Creating firmware images
139-
------------------------
134+
## Creating firmware images
140135

141136
Once you have the **Arduino CMake** package loaded you can start defining firmware images.
142137

@@ -177,8 +172,7 @@ To enable serial terminal, add the `_SERIAL` setting (`@INPUT_PORT@` will be rep
177172

178173

179174

180-
Creating libraries
181-
------------------
175+
## Creating libraries
182176

183177
Creating libraries is very similar to defining a firmware image, except we use the `generate_arduino_library` command. The syntax of the settings is the same except we have a different list of settings:
184178

@@ -207,11 +201,29 @@ Once that library is defined we can use it in our other firmware images... Lets
207201
generate_arduino_firmware(blink)
208202

209203

210-
Windows Enviroment Setup
211-
------------------------
204+
## Windows Enviroment Setup
212205

213-
On Windows the *Arduino SDK* is self contained and has everything needed for building. The only thing that has to be done is to place the *Arduino SDK* either on the **system path** or within the system **Program Files** directory. Also you will need to add the ${ARDUINO_SDK_PATH}/hardware/tools/avr/utils/bin directory path to your system path, just make sure it is the first thing on list.
206+
On Windows the *Arduino SDK* is self contained and has everything needed for building. The only thing that has to be done is to place the *Arduino SDK* either on the **system path** or within the system **Program Files** directory.
207+
208+
Also you will need to add the `${ARDUINO_SDK_PATH}/hardware/tools/avr/utils/bin` directory path to your system path, just make sure it is the first thing on list.
214209

215210
Once that is done you can start using CMake the usual way, just make sure to chose a **MSYS Makefile** type generator.
216211

217-
NOTE: Don't change the default **Arduino SDK** directory name, otherwise auto detection will no work properly!
212+
NOTE: Don't change the default *Arduino SDK* directory name, otherwise auto detection will no work properly!
213+
214+
### Serial Namming
215+
216+
When specifying the serial port name on Windows, use the following names:
217+
218+
com1 com2 ... comN
219+
220+
### Serial Terminal
221+
222+
Putty is a great multi-protocol terminal, which support SSH, Telnet, Serial, and many more... The latest development snapshot supports command line options for serial, for example:
223+
224+
putty -serial COM3 -sercfg 9600,8,n,1,X
225+
226+
Putty - http://tartarus.org/~simon/putty-snapshots/x86/putty-installer.exe
227+
228+
229+

configure.bat

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
::===========================================================================::
2+
:: Author: QueezyTheGreat ::
3+
:: Description: Small wrapper around cmake and cmake-gui for ::
4+
:: easy build system configuration and generation. ::
5+
::===========================================================================::
6+
@echo off
7+
8+
set CURRENT_PATH=%CD%
9+
10+
set CONFIGURE_PATH=%~dp0%
11+
set CONFIGURE_MODE=%1
12+
set CONFIGURE_ARGS=%*
13+
14+
set BUILD_PATh=build
15+
16+
set CMAKE_NAME=cmake.exe
17+
set CMAKEGUI_NAME=cmake-gui.exe
18+
19+
20+
:: Parse arguments
21+
if /i [%CONFIGURE_MODE%] EQU [-h] goto :print_help
22+
if /i [%CONFIGURE_MODE%] EQU [--help] goto :print_help
23+
if /i [%CONFIGURE_MODE%] EQU [/?] goto :print_help
24+
25+
26+
:: Check dependencies
27+
for %%X in (%CMAKE_NAME% %CMAKEGUI_NAME%) do (
28+
set FOUND=%%~$PATH:X
29+
if not defined FOUND (
30+
echo %%X missing on the path, aborting!
31+
echo.
32+
echo Please ensure that CMake is available on the system path.
33+
echo.
34+
pause
35+
goto :EXIT
36+
)
37+
)
38+
39+
:: Generate/Configure build
40+
call :init_build
41+
call :setup_build
42+
43+
44+
::===========================================================================::
45+
:: ::
46+
::===========================================================================::
47+
goto :EXIT
48+
49+
50+
:: Initialize build path
51+
:init_build
52+
if "%CURRENT_PATH%\" EQU "%CONFIGURE_PATH%" (
53+
:: In sources, create build directory
54+
set "BUILD_PATH=%CONFIGURE_PATH%%BUILD_PATH%"
55+
56+
:: Create build directory
57+
if not exist "%BUILD_PATH%" (
58+
mkdir "%BUILD_PATH%"
59+
)
60+
) else (
61+
:: Out of sources, do nothing
62+
set BUILD_PATH=%CD%
63+
)
64+
goto :RETURN
65+
66+
:: Configure/Generate build system
67+
:setup_build
68+
cd "%BUILD_PATH%"
69+
if /i [%CONFIGURE_MODE%] EQU [-c] (
70+
:: Command Line version (cmake)
71+
echo cmake %CONFIGURE_ARGS:~3% "%CONFIGURE_PATH%"
72+
%CMAKE_NAME% %CONFIGURE_ARGS:~3% "%CONFIGURE_PATH%"
73+
) else (
74+
:: GUI version (cmake-gui)
75+
start %CMAKEGUI_NAME% "%CONFIGURE_PATH%"
76+
)
77+
cd "%CURRENT_PATH%"
78+
goto :RETURN
79+
80+
:: Display help message
81+
:print_help
82+
echo configure [-h ^| -c OPTS]
83+
echo -h Display this message
84+
echo -c Command line version of CMake
85+
echo.
86+
echo OPTS Options to pass to CMake command line
87+
echo.
88+
echo Small wrapper around cmake and cmake-gui for
89+
echo easy build system configuration and generation.
90+
echo.
91+
echo For GUI and command line use.
92+
goto :EXIT
93+
94+
:RETURN
95+
:EXIT

0 commit comments

Comments
 (0)