Skip to content

Commit f507db3

Browse files
committed
Merge branch 'busybox' into development
2 parents 031caa1 + 140ed49 commit f507db3

4 files changed

Lines changed: 86 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
### Changed
99
- using busybox as command shell for windows to run the wrapper scripts
1010

11+
### Fixed
12+
- building the core library when using make (regression bug in 0.4.0)
13+
1114

1215
## [0.4.0 - 2018-12-07]
1316
### Added

docs/usage/manual-install.md

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ the hardware folder, if not already present:
3939
Extract the downloaded [SDCC archive](http://sdcc.sourceforge.net/snap.php)
4040
under `/opt`:
4141

42-
```text
42+
```bash
4343
sudo mkdir /opt
4444
sudo tar xvjf ~/Downloads/sdcc-snapshot* -C /opt
4545
```
4646

4747
Create a link to SDCC from the tools directory of the sduino repository
4848
(required for IDE builds):
4949

50-
```text
50+
```bash
5151
cd ~/Arduino/hardware/sduino/tools
5252
ln -s /opt/sdcc .
5353
```
@@ -59,7 +59,7 @@ tools directory. Create a link `linux` to the linux tools directory that
5959
matches your system and copy the binaries to a convient place in your path,
6060
e.g. `/usr/local/bin`:
6161

62-
```text
62+
```bash
6363
ln -s linux64 linux
6464
cp -av linux/* /usr/local/bin
6565
```
@@ -69,7 +69,7 @@ e.g. `/usr/local/bin`:
6969
repository for any Linux distribution. Example for Debian-type systems (like
7070
Ubuntu, Mint, Elementary etc.):
7171

72-
```text
72+
```bash
7373
sudo apt-get install make libusb-1.0-0
7474
```
7575

@@ -81,10 +81,19 @@ tool. Save this as root in in `/etc/udev/rules.d/99-stlink.rules`:
8181
8282
# ST-Link V1, if using a STM8S discovery board
8383
# important: It needs a special entry in /etc/modprobe.d
84-
ATTR{idVendor}=="0483", ATTR{idProduct}=="3744", MODE="0666", GROUP="plugdev"
84+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3744", \
85+
MODE:="0666", \
86+
SYMLINK+="stlinkv1_%n"
8587
8688
# ST-Link/V2, the china adapter with the green plastic housing
87-
ATTR{idVendor}=="0483", ATTR{idProduct}=="3748", MODE="0666", GROUP="plugdev"
89+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", \
90+
MODE:="0666", \
91+
SYMLINK+="stlinkv2_%n"
92+
93+
# ST-Link/V2.1, the new Nucleo STM8 boards
94+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", \
95+
MODE:="0666", \
96+
SYMLINK+="stlinkv2-1_%n"
8897
```
8998

9099
Using the STM8S-Discovery board as a flash programmer requires a [special
@@ -99,7 +108,7 @@ entry](../hardware/stm8sdiscovery#usage-with-linux-and-stm8flash).
99108
Quite similar to the Linux install. [Install Homebrew](https://brew.sh/) if
100109
you haven't done it yet, than install make and unpack the sdcc snapshot:
101110

102-
```text
111+
```bash
103112
brew make
104113
mkdir /opt
105114
tar xvjf sdcc-snapshot* -C /opt
@@ -110,8 +119,7 @@ in your Documents folder at `/Users/<username>/Documents/Arduino/hardware`.
110119

111120
Not sure about stm8flash, I didn't try it. Have a look at the [stm8flash
112121
repository](https://github.com/vdudouyt/stm8flash). It would be great if
113-
someone could summarize the procedure and send it to me together with a
114-
compiled binary for the repository.
122+
someone could summarize the procedure and send it to me.
115123

116124

117125

@@ -121,13 +129,51 @@ compiled binary for the repository.
121129

122130
## Windows
123131

124-
Same idea again, but additionally we need to install a minimal MinGW command
125-
line environment with tools needed by make and the Makefile. Let's start
132+
Same idea again, but additionally we need to install a minimal command line
133+
environment with all the tools needed by make and the Makefile. Let's start
126134
with that:
127135

128136

137+
### Installing a command line environment
138+
139+
This can be any of these options (in order of complexity):
140+
141+
- busybox and make
142+
- Msys2
143+
- MinGW
144+
- Cygwin
145+
146+
The makefile `sduino.mk` uses busybox by default when running on Windows. To
147+
change that, set these environment variables accordingly:
148+
149+
SHELL=bash
150+
.SHELLFLAGS=-c
151+
152+
Alternativly, it is possible to include these lines in the project `Makefile`
153+
or edit `sduino.mk` directly (lines 68, 69).
154+
155+
156+
157+
#### Install busybox and make
158+
159+
This is by far the easiest way to get going. busybox already comes with
160+
sduino in the `hardware/sduino/tools/win/` folder. A statically linked copy
161+
of make-4.2 can be found in the
162+
[windowstools](https://github.com/tenbaht/sduino-windowstools) repository.
163+
164+
Just copy these two binaries into a place somewhere in your `%PATH%`.
165+
166+
167+
129168
#### Install Msys2
130169

170+
Msys2/mingw is more capable than busybox and even comes with a proper
171+
package manager. Install this if you plan on using the command line tools
172+
for more than just running sdunio compilations.
173+
174+
mingw is a full (cross-) compilation environment and it uses msys2, which is
175+
just a collection of basic UNIX tools. msys2 is enough for using sduino.
176+
131177
- Download and run the installer from [http://www.msys2.org](http://www.msys2.org)
132178
- Install make: `pacman -S make`
133179
- define the environment variable `HOME` in the windows settings as
@@ -139,6 +185,24 @@ Now we can start working.
139185
)
140186

141187

188+
#### Cygwin
189+
190+
cygwin is similar to msys2, but even more complete in the sense that it
191+
tries to emulate a full POSIX environment. It is really more like a virtual
192+
machine than just a set of libraries.
193+
194+
Almost anything that compiles for UNIX can be compiled for cygwin with
195+
minimal effort. The downside is that the resulting binaries are linked
196+
against cygwin specific libraries and that they don't mix very well with
197+
Windows native applications. It is possible to do it, but it might require
198+
some extra effort.
199+
200+
Install this if you need full POSIX compliance. (e.g. compiling
201+
stm8flash with support for espstlink, that requires the POSIX termios
202+
library).
203+
204+
205+
142206
#### Install the core files and SDCC
143207

144208
Thanks to the running bash the remaining steps are the same as for Linux,

sduino/Arduino.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,10 @@ ifneq (,$(findstring AVR,$(shell $(SIZE) --help)))
11361136
# and the elf to get nice output.
11371137
avr_size = $(SIZE) $(SIZEFLAGS) --format=avr $(1)
11381138
$(call show_config_info,Size utility: AVR-aware for enhanced output,[AUTODETECTED])
1139+
else ifneq (,$(findstring map,$(shell $(SIZE) --help)))
1140+
# We have a script for SDCC. pass it the map file instead of the hex file
1141+
avr_size = $(SIZE) $(2:ihx=map)
1142+
$(call show_config_info,Size utility: SDCC compatible script,[AUTODETECTED])
11391143
else
11401144
# We have a plain-old binutils version - just give it the hex.
11411145
avr_size = $(SIZE) $(2)

sduino/sduino.mk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ ifeq ($(OS),Windows_NT)
6565
# for Windows always assume the tools to be in this dir tree
6666
SDCC_PATH := $(ARDUINO_DIR)/hardware/sduino/tools/sdcc/bin
6767
endif
68-
# SHELL := $(ARDUINO_DIR)/hardware/sduino/tools/win/dash
69-
SHELL := dash
68+
SHELL := $(ARDUINO_DIR)/hardware/sduino/tools/win/busybox.exe
69+
.SHELLFLAGS=ash -c
70+
SIZE := $(ARDUINO_DIR)/hardware/sduino/tools/wrapper/sdsize.sh
7071
# PATH := $(realpath $(ARDUINO_DIR)/hardware/sduino/tools/win):$(PATH)
7172
else
7273
# Linux (and Mac): expect SDCC to be in /opt/sdcc
@@ -81,7 +82,7 @@ OVERRIDE_EXECUTABLES=yes
8182
CC = $(SDCC_PATH)/sdcc
8283
AS = $(SDCC_PATH)/sdasstm8
8384
AR = $(SDCC_PATH)/sdar
84-
SIZE = /usr/bin/size
85+
SIZE ?= /usr/bin/size
8586

8687

8788
ARDUINO_SKETCHBOOK = /tmp # temporarly, to prevent usage of the real libs

0 commit comments

Comments
 (0)