Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit 4a93801

Browse files
committed
all: Update Makefiles and others to build with new ports/ dir layout.
Also renames "stmhal" to "stm32" in documentation and everywhere else.
1 parent 01dd780 commit 4a93801

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+150
-161
lines changed

.gitattributes

-11
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@
1515
# These should also not be modified by git.
1616
tests/basics/string_cr_conversion.py -text
1717
tests/basics/string_crlf_conversion.py -text
18-
stmhal/pybcdc.inf_template -text
19-
stmhal/usbd_* -text
20-
stmhal/boards/*/stm32f4xx_hal_conf.h -text
21-
stmhal/usbdev/** -text
22-
stmhal/usbhost/** -text
23-
cc3200/hal/aes.c -text
24-
cc3200/hal/aes.h -text
25-
cc3200/hal/des.c -text
26-
cc3200/hal/i2s.c -text
27-
cc3200/hal/i2s.h -text
28-
cc3200/version.h -text
2918
ports/stm32/pybcdc.inf_template -text
3019
ports/stm32/usbd_* -text
3120
ports/stm32/boards/*/stm32f4xx_hal_conf.h -text

.travis.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,40 @@ before_script:
2828

2929
script:
3030
- make -C mpy-cross
31-
- make -C minimal CROSS=1 build/firmware.bin
32-
- ls -l minimal/build/firmware.bin
31+
- make -C ports/minimal CROSS=1 build/firmware.bin
32+
- ls -l ports/minimal/build/firmware.bin
3333
- tools/check_code_size.sh
3434
- mkdir -p ${HOME}/persist
3535
# Save new firmware for reference, but only if building a main branch, not a pull request
36-
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp minimal/build/firmware.bin ${HOME}/persist/; fi'
37-
- make -C unix deplibs
38-
- make -C unix
39-
- make -C unix nanbox
40-
- make -C bare-arm
41-
- make -C qemu-arm test
42-
- make -C stmhal
43-
- make -C stmhal BOARD=PYBV11 MICROPY_PY_WIZNET5K=1 MICROPY_PY_CC3K=1
44-
- make -C stmhal BOARD=STM32F769DISC
45-
- make -C stmhal BOARD=STM32L476DISC
46-
- make -C teensy
47-
- make -C cc3200 BTARGET=application BTYPE=release
48-
- make -C cc3200 BTARGET=bootloader BTYPE=release
49-
- make -C windows CROSS_COMPILE=i686-w64-mingw32-
36+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp ports/minimal/build/firmware.bin ${HOME}/persist/; fi'
37+
- make -C ports/unix deplibs
38+
- make -C ports/unix
39+
- make -C ports/unix nanbox
40+
- make -C ports/bare-arm
41+
- make -C ports/qemu-arm test
42+
- make -C ports/stm32
43+
- make -C ports/stm32 BOARD=PYBV11 MICROPY_PY_WIZNET5K=1 MICROPY_PY_CC3K=1
44+
- make -C ports/stm32 BOARD=STM32F769DISC
45+
- make -C ports/stm32 BOARD=STM32L476DISC
46+
- make -C ports/teensy
47+
- make -C ports/cc3200 BTARGET=application BTYPE=release
48+
- make -C ports/cc3200 BTARGET=bootloader BTYPE=release
49+
- make -C ports/windows CROSS_COMPILE=i686-w64-mingw32-
5050

5151
# run tests without coverage info
5252
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests)
5353
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native)
5454

5555
# run tests with coverage info
56-
- make -C unix coverage
57-
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests)
58-
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests -d thread)
59-
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --emit native)
60-
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --via-mpy -d basics float)
56+
- make -C ports/unix coverage
57+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests)
58+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -d thread)
59+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --emit native)
60+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --via-mpy -d basics float)
6161

6262
# run coveralls coverage analysis (try to, even if some builds/tests failed)
63-
- (cd unix && coveralls --root .. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
63+
- (cd ports/unix && coveralls --root ../.. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
6464

6565
after_failure:
6666
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)
67-
- (grep "FAIL" qemu-arm/build/console.out)
67+
- (grep "FAIL" ports/qemu-arm/build/console.out)

README.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,24 @@ Major components in this repository:
3434
core library.
3535
- mpy-cross/ -- the MicroPython cross-compiler which is used to turn scripts
3636
into precompiled bytecode.
37-
- unix/ -- a version of MicroPython that runs on Unix.
38-
- stmhal/ -- a version of MicroPython that runs on the PyBoard and similar
37+
- ports/unix/ -- a version of MicroPython that runs on Unix.
38+
- ports/stm32/ -- a version of MicroPython that runs on the PyBoard and similar
3939
STM32 boards (using ST's Cube HAL drivers).
40-
- minimal/ -- a minimal MicroPython port. Start with this if you want
40+
- ports/minimal/ -- a minimal MicroPython port. Start with this if you want
4141
to port MicroPython to another microcontroller.
4242
- tests/ -- test framework and test scripts.
4343
- docs/ -- user documentation in Sphinx reStructuredText format. Rendered
4444
HTML documentation is available at http://docs.micropython.org (be sure
4545
to select needed board/port at the bottom left corner).
4646

4747
Additional components:
48-
- bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
48+
- ports/bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
4949
mostly to control code size.
50-
- teensy/ -- a version of MicroPython that runs on the Teensy 3.1
50+
- ports/teensy/ -- a version of MicroPython that runs on the Teensy 3.1
5151
(preliminary but functional).
52-
- pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
53-
- cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
54-
- esp8266/ -- an experimental port for ESP8266 WiFi modules.
52+
- ports/pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
53+
- ports/cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
54+
- ports/esp8266/ -- an experimental port for ESP8266 WiFi modules.
5555
- extmod/ -- additional (non-core) modules implemented in C.
5656
- tools/ -- various tools, including the pyboard.py module.
5757
- examples/ -- a few example Python scripts.
@@ -72,7 +72,7 @@ Alternatively, fallback implementation based on setjmp/longjmp can be used.
7272

7373
To build (see section below for required dependencies):
7474

75-
$ cd unix
75+
$ cd ports/unix
7676
$ make axtls
7777
$ make
7878

@@ -115,33 +115,33 @@ these additional dependencies, first fetch git submodules for them:
115115
$ git submodule update --init
116116

117117
Use this same command to get the latest versions of dependencies, as
118-
they are updated from time to time. After that, in `unix/` dir, execute:
118+
they are updated from time to time. After that, in `ports/unix/` dir, execute:
119119

120120
$ make deplibs
121121

122122
This will build all available dependencies (regardless whether they
123123
are used or not). If you intend to build MicroPython with additional
124124
options (like cross-compiling), the same set of options should be passed
125125
to `make deplibs`. To actually enabled use of dependencies, edit
126-
`unix/mpconfigport.mk` file, which has inline descriptions of the options.
126+
`ports/unix/mpconfigport.mk` file, which has inline descriptions of the options.
127127
For example, to build SSL module (required for `upip` tool described above),
128128
set `MICROPY_PY_USSL` to 1.
129129

130-
In `unix/mpconfigport.mk`, you can also disable some dependencies enabled
130+
In `ports/unix/mpconfigport.mk`, you can also disable some dependencies enabled
131131
by default, like FFI support, which requires libffi development files to
132132
be installed.
133133

134-
The STM version
135-
---------------
134+
The STM32 version
135+
-----------------
136136

137-
The "stmhal" port requires an ARM compiler, arm-none-eabi-gcc, and associated
137+
The "stm32" port requires an ARM compiler, arm-none-eabi-gcc, and associated
138138
bin-utils. For those using Arch Linux, you need arm-none-eabi-binutils and
139139
arm-none-eabi-gcc packages. Otherwise, try here:
140140
https://launchpad.net/gcc-arm-embedded
141141

142142
To build:
143143

144-
$ cd stmhal
144+
$ cd ports/stm32
145145
$ make
146146

147147
You then need to get your board into DFU mode. On the pyboard, connect the
@@ -155,4 +155,4 @@ Then to flash the code via USB DFU to your device:
155155
This will use the included `tools/pydfu.py` script. If flashing the firmware
156156
does not work it may be because you don't have the correct permissions, and
157157
need to use `sudo make deploy`.
158-
See the README.md file in the stmhal/ directory for further details.
158+
See the README.md file in the ports/stm32/ directory for further details.

docs/reference/constrained.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ After importing the modules, execute:
279279
280280
Then copy and paste all the Q(xxx) lines into a text editor. Check for and
281281
remove lines which are obviously invalid. Open the file qstrdefsport.h which
282-
will be found in stmhal (or the equivalent directory for the architecture in
282+
will be found in ports/stm32 (or the equivalent directory for the architecture in
283283
use). Copy and paste the corrected lines at the end of the file. Save the file,
284284
rebuild and flash the firmware. The outcome can be checked by importing the
285285
modules and again issuing:

examples/pins.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Print a nice list of pins, their current settings, and available afs.
2-
# Requires pins_af.py from stmhal/build-PYBV10/ directory.
2+
# Requires pins_af.py from ports/stm32/build-PYBV10/ directory.
33

44
import pyb
55
import pins_af

extmod/modframebuf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#if MICROPY_PY_FRAMEBUF
3535

36-
#include "stmhal/font_petme128_8x8.h"
36+
#include "ports/stm32/font_petme128_8x8.h"
3737

3838
typedef struct _mp_obj_framebuf_t {
3939
mp_obj_base_t base;

mpy-cross/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ SRC_C = \
6565
# Add fmode when compiling with mingw gcc
6666
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
6767
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
68-
SRC_C += windows/fmode.c
68+
SRC_C += ports/windows/fmode.c
6969
endif
7070

7171
OBJ = $(PY_O)

mpy-cross/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "py/gc.h"
3737
#include "py/stackctrl.h"
3838
#ifdef _WIN32
39-
#include "windows/fmode.h"
39+
#include "ports/windows/fmode.h"
4040
#endif
4141

4242
// Command line options, with their defaults

ports/bare-arm/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include ../py/mkenv.mk
1+
include ../../py/mkenv.mk
22

33
# qstr definitions (must come before including py.mk)
44
QSTR_DEFS = qstrdefsport.h

ports/cc3200/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PORT ?= /dev/ttyUSB1
1414
# If the build directory is not given, make it reflect the board name.
1515
BUILD ?= build/$(BOARD)/$(BTYPE)
1616

17-
include ../py/mkenv.mk
17+
include ../../py/mkenv.mk
1818
-include ../../localconfig.mk
1919

2020
CROSS_COMPILE ?= arm-none-eabi-

ports/cc3200/application.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ APP_INC += -Iutil
1818
APP_INC += -Ibootmgr
1919
APP_INC += -I$(BUILD)
2020
APP_INC += -I$(BUILD)/genhdr
21-
APP_INC += -I$(TOP)/stmhal
21+
APP_INC += -I$(TOP)/ports/stm32
2222

2323
APP_CPPDEFINES = -Dgcc -DTARGET_IS_CC3200 -DSL_FULL -DUSE_FREERTOS
2424

@@ -151,7 +151,7 @@ APP_LIB_SRC_C = $(addprefix lib/,\
151151
utils/sys_stdio_mphal.c \
152152
)
153153

154-
APP_STM_SRC_C = $(addprefix stmhal/,\
154+
APP_STM_SRC_C = $(addprefix ports/stm32/,\
155155
bufhelper.c \
156156
irq.c \
157157
)

ports/cc3200/bootmgr/bootloader.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ $(BUILD)/misc/%.o: CFLAGS += -Os
9898
$(BUILD)/simplelink/%.o: CFLAGS += -Os
9999
$(BUILD)/drivers/cc3100/%.o: CFLAGS += -Os
100100
$(BUILD)/py/%.o: CFLAGS += -Os
101-
$(BUILD)/stmhal/%.o: CFLAGS += -Os
101+
$(BUILD)/ports/stm32/%.o: CFLAGS += -Os
102102
else
103103
$(error Invalid BTYPE specified)
104104
endif

ports/esp8266/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include ../py/mkenv.mk
1+
include ../../py/mkenv.mk
22

33
# qstr definitions (must come before including py.mk)
44
QSTR_DEFS = qstrdefsport.h #$(BUILD)/pins_qstr.h

ports/esp8266/esp_mphal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void ets_event_poll(void);
7272
// C-level pin HAL
7373
#include "etshal.h"
7474
#include "gpio.h"
75-
#include "esp8266/modmachine.h"
75+
#include "modmachine.h"
7676
#define MP_HAL_PIN_FMT "%u"
7777
#define mp_hal_pin_obj_t uint32_t
7878
#define mp_hal_get_pin_obj(o) mp_obj_get_pin(o)

ports/esp8266/modules/ds18x20.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../drivers/onewire/ds18x20.py
1+
../../../drivers/onewire/ds18x20.py

ports/esp8266/modules/onewire.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../drivers/onewire/onewire.py
1+
../../../drivers/onewire/onewire.py

ports/esp8266/modules/upip.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../tools/upip.py
1+
../../../tools/upip.py
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../tools/upip_utarfile.py
1+
../../../tools/upip_utarfile.py

ports/minimal/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include ../py/mkenv.mk
1+
include ../../py/mkenv.mk
22

33
CROSS = 0
44

ports/pic16bit/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include ../py/mkenv.mk
1+
include ../../py/mkenv.mk
22

33
# qstr definitions (must come before including py.mk)
44
QSTR_DEFS = qstrdefsport.h

ports/qemu-arm/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include ../py/mkenv.mk
1+
include ../../py/mkenv.mk
22
-include mpconfigport.mk
33

44
# qstr definitions (must come before including py.mk)

ports/stm32/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ endif
88
# If the build directory is not given, make it reflect the board name.
99
BUILD ?= build-$(BOARD)
1010

11-
include ../py/mkenv.mk
11+
include ../../py/mkenv.mk
1212
-include mpconfigport.mk
1313
include boards/$(BOARD)/mpconfigboard.mk
1414

@@ -206,7 +206,7 @@ SRC_C = \
206206
timer.c \
207207
led.c \
208208
pin.c \
209-
pin_defs_stmhal.c \
209+
pin_defs_stm32.c \
210210
pin_named_pins.c \
211211
bufhelper.c \
212212
dma.c \

ports/stm32/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bytecode. The cross-compiler is built and run on the host machine, using:
2424
$ make -C mpy-cross
2525
```
2626
This command should be executed from the root directory of this repository.
27-
All other commands below should be executed from the stmhal/ directory.
27+
All other commands below should be executed from the ports/stm32/ directory.
2828

2929
An ARM compiler is required for the build, along with the associated binary
3030
utilities. The default compiler is `arm-none-eabi-gcc`, which is available for
@@ -71,7 +71,7 @@ Or using `dfu-util` directly:
7171

7272
ST Discovery or Nucleo boards have a builtin programmer called ST-LINK. With
7373
these boards and using Linux or OS X, you have the option to upload the
74-
`stmhal` firmware using the `st-flash` utility from the
74+
`stm32` firmware using the `st-flash` utility from the
7575
[stlink](https://github.com/texane/stlink) project. To do so, connect the board
7676
with a mini USB cable to its ST-LINK USB port and then use the make target
7777
`deploy-stlink`. For example, if you have the STM32F4DISCOVERY board, you can
@@ -101,7 +101,7 @@ a mini USB cable to its ST-LINK USB port and then use the make target
101101
$ make BOARD=STM32F4DISC deploy-openocd
102102

103103
The `openocd` program, which writes the firmware to the target board's flash,
104-
is configured via the file `stmhal/boards/openocd_stm32f4.cfg`. This
104+
is configured via the file `ports/stm32/boards/openocd_stm32f4.cfg`. This
105105
configuration should work for all boards based on a STM32F4xx MCU with a
106106
ST-LINKv2 interface. You can override the path to this configuration by setting
107107
`OPENOCD_CONFIG` in your Makefile or on the command line.

ports/stm32/boards/NUCLEO_F401RE/stm32f4xx_hal_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
/* Exported types ------------------------------------------------------------*/
4747
/* Exported constants --------------------------------------------------------*/
4848

49-
// This board doesn't really have USB, but the stmhal codebase doesn't build
49+
// This board doesn't really have USB, but the stm32 codebase doesn't build
5050
// without some USB defined, so we leave this on for now.
5151
#define USE_USB_FS
5252

ports/stm32/boards/NUCLEO_F411RE/stm32f4xx_hal_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
/* Exported types ------------------------------------------------------------*/
4747
/* Exported constants --------------------------------------------------------*/
4848

49-
// This board doesn't really have USB, but the stmhal codebase doesn't build
49+
// This board doesn't really have USB, but the stm32 codebase doesn't build
5050
// without some USB defined, so we leave this on for now.
5151
#define USE_USB_FS
5252

ports/stm32/boards/NUCLEO_F446RE/stm32f4xx_hal_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
/* Exported types ------------------------------------------------------------*/
4747
/* Exported constants --------------------------------------------------------*/
4848

49-
// This board doesn't really have USB, but the stmhal codebase doesn't build
49+
// This board doesn't really have USB, but the stm32 codebase doesn't build
5050
// without some USB defined, so we leave this on for now.
5151
#define USE_USB_FS
5252

ports/stm32/help.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "py/builtin.h"
2828

29-
const char *stmhal_help_text =
29+
const char *stm32_help_text =
3030
"Welcome to MicroPython!\n"
3131
"\n"
3232
"For online help please visit http://micropython.org/help/.\n"

ports/stm32/modules/lcd160cr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../drivers/display/lcd160cr.py
1+
../../../drivers/display/lcd160cr.py

ports/stm32/modules/lcd160cr_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../drivers/display/lcd160cr_test.py
1+
../../../drivers/display/lcd160cr_test.py

0 commit comments

Comments
 (0)