Skip to content

Commit 2ee7db7

Browse files
committed
Add build automation via Github Actions
1 parent 29f667b commit 2ee7db7

File tree

5 files changed

+86
-1292
lines changed

5 files changed

+86
-1292
lines changed

.github/workflows/main.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# Author lea_calot
3+
#
4+
name: FirmwareBuild
5+
6+
on:
7+
push:
8+
branches: [ ]
9+
tags:
10+
- 'v*'
11+
workflow_dispatch:
12+
13+
jobs:
14+
build_firmware:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
18+
uses: carlosperate/arm-none-eabi-gcc-action@v1
19+
with:
20+
release: '11.2-2022.02'
21+
22+
- name: Install SEGGER J-Link RTT
23+
run: |
24+
wget --post-data "accept_license_agreement=accepted" -c https://www.segger.com/downloads/jlink/JLink_Linux_V792_x86_64.tgz
25+
tar xvzf JLink_Linux_V792_x86_64.tgz
26+
tar xvzf JLink_Linux_V792_x86_64/Samples/RTT/SEGGER_RTT_V792.tgz
27+
cp SEGGER_RTT_V792/Config/SEGGER_RTT_Conf.h SEGGER_RTT_V792/RTT/
28+
29+
- name: Install CubeMX G0
30+
run: |
31+
git clone --recursive -b v1.6.0 https://github.com/STMicroelectronics/STM32CubeG0.git
32+
33+
- name: Check out repository
34+
uses: actions/checkout@v4
35+
with:
36+
path: NeoDK
37+
38+
- name: Build Firmware
39+
run: |
40+
echo $(pwd)
41+
cd NeoDK/firmware
42+
SEGGER=~/work/NeoDK/NeoDK/SEGGER_RTT_V792/RTT/ STM32CUBE_G0=~/work/NeoDK/NeoDK/STM32CubeG0 GNU_INSTALL_ROOT=$(dirname $(which arm-none-eabi-gcc))/ make
43+
44+
- name: Upload firmware artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: neodk_firmware
48+
compression-level: 9
49+
path: |
50+
NeoDK/firmware/build/neodk_g071.bin
51+
NeoDK/firmware/build/neodk_g071.hex

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ Discord: @Onwrikbaar<br/>
1010
1111

1212
### Status
13-
This is a work in progress. Updates may be few and far between.
14-
15-
### Request
16-
Please send me an e-mail in case you are building this design, and let me know whether you run into any questions or problems. It will help me decide how I can best lower the threshold to replicating NeoDK. Thanks!
13+
This is a work in progress. The electronics are production-ready. The firmware is far from finished.
1714

1815
### Goals
1916
1. The last quarter century, innovation in the e-stim realm has been virtually nonexistent, despite massive advances in electronics and cheap computing power. Currently available commercial devices are without exception channel-oriented and produce TENS-like waveforms. Most are horrendously energy-inefficient. The time has come to unlock the potential of a more capable architecture.

firmware/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ MAO_LIB_SRC := maolib/src
1111
PROJ_DIR_INC := inc
1212
PROJ_DIR_SRC := src
1313
STM32REPO := $(HOME)/STM32Cube/Repository
14-
STM32CUBE_G0 := $(STM32REPO)/STM32Cube_FW_G0_V1.6.0
15-
SEGGER := $(HOME)/SEGGER_RTT
14+
STM32CUBE_G0 ?= $(STM32REPO)/STM32Cube_FW_G0_V1.6.0
15+
SEGGER ?= $(HOME)/SEGGER_RTT
1616

1717
$(OUTPUT_DIRECTORY)/neodk_g071.out: \
1818
LINKER_SCRIPT := STM32G071_FLASH.ld
@@ -47,7 +47,7 @@ STM32G0xx_INC += \
4747
$(STM32CUBE_G0)/Drivers/CMSIS/Core/Include \
4848
$(STM32CUBE_G0)/Drivers/CMSIS/Device/ST/STM32G0xx/Include \
4949
$(STM32CUBE_G0)/Drivers/STM32G0xx_HAL_Driver/Inc \
50-
$(HOME)/gcc-arm/arm-none-eabi/include \
50+
$(GNU_INSTALL_ROOT)/../include \
5151
$(SEGGER) \
5252

5353
# Libraries common to all targets

firmware/Setup.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
1-
### ARM gcc
1+
## Updating the firmware without using a debugging probe
2+
1. Download and install STM's free [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) programming tool.
3+
2. Connect NeoDK to a computer using a USB-to-3.5mm-TRS-serial cable. Suitable cables (3.3V TTL, Tip=Tx, Ring=Rx, Sleeve=GND) are readily available from various sources, like Aliexpress, for about €10 including shipping.
4+
3. Press and hold the pushbutton on NeoDK while switching on its power (or connecting the battery). This puts NeoDK in bootloader mode. Release the button.
5+
4. Open a terminal window and execute the following on the command line:<br/>
6+
&nbsp;&nbsp;`cd firmware`<br/>
7+
&nbsp;&nbsp;`STM32_Programmer_CLI -c port=/dev/tty.usbserial-0001 -w build/neodk_g071.hex -v`<br/>
8+
(Specify the COM port that corresponds to your USB-serial cable, in place of `/dev/tty.usbserial-0001`).<br/>
9+
A power cycle starts the firmware; the blue LED should light up and the box is ready for use.
10+
11+
## Controlling NeoDK from a computer
12+
1. Connect NeoDK to a computer using a USB-to-3.5mm-TRS-serial cable (3.3V TTL, Tip=Tx, Ring=Rx, Sleeve=GND).
13+
2. Open a Chrome, Edge or Opera browser window and point it to the [NUUI](https://deviceweb.org/neostim) (Neostim Ugly User Interface).
14+
3. The following commands can be typed into the command box:
15+
- /? list the commands
16+
- /a print the instantaneous primary current and some voltages
17+
- /b simulate the button, to start/pause/resume the pattern
18+
- /d primary voltage down by 200 mV
19+
- /l toggle the lovely blue LED
20+
- /u primary voltage up by 200 mV
21+
- /v print firmware version
22+
- /0 (zero) turn off the primary voltage
23+
- /1../9 set the primary voltage to 1..9 Volt (be careful what you wish for)
24+
25+
## Developing code for NeoDK
26+
### Debugging probe
27+
A suitable probe is the Segger JLink or Segger JLink EDU. Other probes supporting the SWD interface will work too.
28+
29+
### Compiler
230
1. Download and install the [Arm GNU Toolchain](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) for bare metal targets.
331
2. Edit [Makefile.posix](toolchain/gcc/Makefile.posix) or [Makefile.windows](toolchain/gcc/Makefile.windows) (depending on your operating system) to set three environment variables to their appropriate values. Alternatively, they can be set in the startup file for your command line interface.
432

5-
### STM32Cube
33+
### STM's low-level code library
634
1. Download and install [STM32Cube for STM32G0 series](https://www.st.com/en/embedded-software/stm32cubeg0.html).
735
2. In your home directory, create a softlink to directory 'STM32Cube' of the just installed tree.
836

9-
### SEGGER J-Link
37+
### SEGGER J-Link software
1038
1. Download and install [Segger J-Link](https://www.segger.com/downloads/jlink/).
1139
2. In the just installed Segger directory tree, find file JLink_V792k/Samples/RTT/SEGGER_RTT_V792k.tgz and unpack it in place.
1240
3. In your home directory, create a softlink named 'SEGGER_RTT' to directory 'JLink_V792k/Samples/RTT/SEGGER_RTT_V792k/RTT' of the just installed tree.
@@ -35,15 +63,3 @@ This should now show output from NeoDK.<br>
3563
In the JLinkRTTClient window, type<br>
3664
&nbsp;&nbsp;`/?`<br>
3765
to see a list of available NeoDK interactive commands.
38-
39-
### Updating the firmware without using a debugging probe
40-
1. Download and install STM's free [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) programming tool.
41-
2. Connect NeoDK to a computer using a USB-to-3.5mm-TRS-serial cable. Suitable cables (3.3V TTL, Tip=Tx, Ring=Rx, Sleeve=GND) are readily available from various sources, like Aliexpress, for about €10 including shipping.
42-
3. Press and hold the pushbutton on NeoDK while switching on its power (or connecting the battery). This puts NeoDK in bootloader mode. Release the button.
43-
4. Open a terminal window and execute the following on the command line:<br/>
44-
&nbsp;&nbsp;`cd firmware`<br/>
45-
&nbsp;&nbsp;`STM32_Programmer_CLI -c port=/dev/tty.usbserial-0001 -w build/neodk_g071.hex -v`<br/>
46-
(Specify the COM port that corresponds to your USB-serial cable, in place of `/dev/tty.usbserial-0001`).<br/>
47-
If flashing was successful, execute:<br/>
48-
&nbsp;&nbsp;`STM32_Programmer_CLI -c port=/dev/tty.usbserial-0001 -g`<br/>
49-
This last command starts the firmware; the blue LED should light up and the box is ready for use. A power cycle instead of this command will have the same effect.

0 commit comments

Comments
 (0)