Skip to content

Commit 1a45542

Browse files
committed
Add Mac OS X External Tools functionality
1 parent ce237ba commit 1a45542

File tree

5 files changed

+156
-1
lines changed

5 files changed

+156
-1
lines changed

README-MacOS.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
README for MacOS
2+
3+
Overview
4+
5+
This describes the initially implemented support on Mac OS X.
6+
7+
The Mac funtionality has been tested, but other users will likely find issues. Please submit issues at https://sourceforge.net/p/qpc/bugs/ and submit questions and suggestions at https://sourceforge.net/p/qpc/discussion/668726/
8+
9+
Install Dependencies
10+
11+
1. Install the AVR-GCC tooltrain for Mac OS X. Following are the commands to install using Homebrew (must have Homebrew installed):
12+
13+
> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
14+
> brew tap osx-cross/avr
15+
> brew install avr-libc
16+
> brew install avrdude --with-usb
17+
18+
2. Install Arduino for Mac OS X by placing the Arduino application in the Applications folder. Open the application at least one time to overcome security warnings.
19+
20+
3. Install Install QP-nano for Arduino into your Documents/Arduino folder (documentation refers to this as the Arduino Sketchbook folder).
21+
22+
4. Install QM.
23+
24+
Instructions for Configuring External Tools for a Model
25+
26+
1. Ensure the model is not open in QM.
27+
28+
2. Copy the Blinky model's settings (libraries/qpn_avr/examples/blinky/.blinky.macos) from your Arduino Sketchbook folder to the model's folder.
29+
30+
3. Rename the settings file to your model's name (i.e., .mymodel).
31+
32+
4. Open QM and edit the settings from External Tools.
33+
34+
Once you have a working .model file, copy it to other models and use it as a starting point.
35+
36+
Known Issues
37+
38+
1. The serialterm External Tool is working by opening a Terminal window. An additional Terminal window also appears and can be safely closed. When the Terminal window displaying the Arduino's output is closed, the port is busy and can no longer be accessed. Work-around is to unplug and re-connect the Arduino from the Mac's USB port.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<session version="3.3.0">
3+
<item name="license">GPL</item>
4+
<group name="locked"/>
5+
<group name="settings">
6+
<item name="tabs">1</item>
7+
<item name="windows">0</item>
8+
<item name="grid">3</item>
9+
</group>
10+
<group name="windows">
11+
<item id=".::blinky.ino">0,0,800,445</item>
12+
<item id="AOs::Blinky::SM">0,0,800,445,*</item>
13+
</group>
14+
<group name="search">
15+
<item name="options">4129280</item>
16+
<item name="replace">1</item>
17+
</group>
18+
<group name="vars">
19+
<item id="PROJECT">blinky</item>
20+
<item id="ARDUINO_HOME">C:\Program Files (x86)\Arduino</item>
21+
<item id="ARDUINO_SKETCHBOOK">C:\Users\Miro\Documents\Arduino</item>
22+
<item id="BOARD_MCU">atmega328p</item>
23+
<item id="BOARD_VARIANT">standard</item>
24+
<item id="BOARD_F_MHZ">16</item>
25+
<item id="BOARD_COM">COM5</item>
26+
<item id="BOARD_BAUD">115200</item>
27+
</group>
28+
<group name="tools">
29+
<group name="tool">
30+
<item name="icon">3</item>
31+
<item name="title">build</item>
32+
<item name="command">&quot;%ARDUINO_SKETCHBOOK%\tools\utils\tclsh.exe&quot;</item>
33+
<item name="args">&quot;%ARDUINO_SKETCHBOOK%\tools\scripts\build_avr.tcl&quot; %PROJECT% &quot;qpn_avr&quot;</item>
34+
<item name="initial">.</item>
35+
<item name="options">3</item>
36+
</group>
37+
<group name="tool">
38+
<item name="icon">5</item>
39+
<item name="title">clean</item>
40+
<item name="command">&quot;%ARDUINO_SKETCHBOOK%\tools\utils\rm.exe&quot;</item>
41+
<item name="args">bin\*</item>
42+
<item name="initial">.</item>
43+
<item name="options">2</item>
44+
</group>
45+
<group name="tool">
46+
<item name="icon">6</item>
47+
<item name="title">upload</item>
48+
<item name="command">&quot;%ARDUINO_SKETCHBOOK%\tools\scripts\upload_avr.bat&quot;</item>
49+
<item name="args">%PROJECT%</item>
50+
<item name="initial">.</item>
51+
<item name="options">2</item>
52+
</group>
53+
<group name="tool">
54+
<item name="icon">8</item>
55+
<item name="title">serialterm</item>
56+
<item name="command">&quot;%ARDUINO_SKETCHBOOK%\tools\utils\serialterm.exe&quot;</item>
57+
<item name="args">%BOARD_COM% %BOARD_BAUD%</item>
58+
<item name="initial"></item>
59+
<item name="options">4</item>
60+
</group>
61+
<group name="tool">
62+
<item name="icon">5</item>
63+
<item name="title">clean all</item>
64+
<item name="command">&quot;%ARDUINO_SKETCHBOOK%\tools\utils\rm.exe&quot;</item>
65+
<item name="args">bin\* lib\*</item>
66+
<item name="initial"></item>
67+
<item name="options">2</item>
68+
</group>
69+
</group>
70+
</session>

tools/scripts/build_avr.tcl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,20 @@ set ARDUINO_LIBS [lindex $argv 1]
4646
set ARDUINO_DEFS [lindex $argv 2]
4747

4848
#=============================================================================
49+
switch $tcl_platform(os) {
50+
"Darwin" { ; # Mac OS X
51+
set ARDUINO_HOME $env(ARDUINO_HOME)
52+
set ARDUINO_SKETCHBOOK $env(ARDUINO_SKETCHBOOK)
53+
}
54+
default { ; # DOS
4955
# change the provided names to DOS-convention to avoid spaces and special
5056
# characters in the path names...
5157
set ARDUINO_HOME \
5258
[file attributes [string trim $env(ARDUINO_HOME) \"] -shortname]
5359
set ARDUINO_SKETCHBOOK \
5460
[file attributes [string trim $env(ARDUINO_SKETCHBOOK) \"] -shortname]
61+
}
62+
}
5563

5664
set BOARD_MCU $env(BOARD_MCU)
5765
set BOARD_VARIANT $env(BOARD_VARIANT)
@@ -61,12 +69,18 @@ set BOARD_CORE "arduino"
6169
# set the CYGWIN environment variable to avoid warnings about DOS file names
6270
set env(CYGWIN) nodosfilewarning
6371

72+
switch $tcl_platform(os) {
73+
"Darwin" { ; # Mac OS X
74+
set AVR_TOOLS $env(AVR_TOOLS)
75+
}
76+
default { ; # DOS
6477
set AVR_TOOLS "$ARDUINO_HOME/hardware/tools/avr/bin"
78+
}
79+
}
6580
set CC "$AVR_TOOLS/avr-gcc"
6681
set CXX "$AVR_TOOLS/avr-g++"
6782
set AR "$AVR_TOOLS/avr-ar"
6883
set LINK "$AVR_TOOLS/avr-gcc"
69-
7084
set OBJCOPY "$AVR_TOOLS/avr-objcopy"
7185
set OBJDUMP "$AVR_TOOLS/avr-objdump"
7286

tools/scripts/serialterm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
osascript -e 'tell application "Terminal" to do script "screen /dev/cu.usbmodem1411 9600"'

tools/scripts/upload_avr.tcl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
proc make.exec args {
3+
set cmd [join $args]
4+
puts $cmd
5+
catch {eval exec -- $cmd} msg
6+
if {[string length $msg]} {
7+
puts $msg
8+
}
9+
global EXEC
10+
incr EXEC
11+
}
12+
13+
set PROJECT $env(PROJECT)
14+
15+
set BOARD_MCU $env(BOARD_MCU)
16+
set BOARD_COM $env(BOARD_COM)
17+
set BOARD_BAUD $env(BOARD_BAUD)
18+
19+
set ARDUINO_HOME $env(ARDUINO_HOME)
20+
set ARDUINO_SKETCHBOOK $env(ARDUINO_SKETCHBOOK)
21+
22+
set AVR_TOOLS $env(AVR_TOOLS)
23+
set AVRDUDE "$AVR_TOOLS/avrdude"
24+
25+
switch $tcl_platform(os) {
26+
"Darwin" {
27+
make.exec $AVRDUDE -p $BOARD_MCU -c arduino -P $BOARD_COM -b $BOARD_BAUD -D -v -C "$ARDUINO_HOME/hardware/tools/avr/etc/avrdude.conf" -U flash:w:bin/$PROJECT.hex:i
28+
}
29+
default {
30+
puts "Unknown OS"
31+
}
32+
}

0 commit comments

Comments
 (0)