all: Update Makefiles and others to build with new ports/ dir layout.

Also renames "stmhal" to "stm32" in documentation and everywhere else.
This commit is contained in:
Damien George 2017-09-06 14:09:13 +10:00
parent 01dd7804b8
commit 4a93801c12
51 changed files with 150 additions and 161 deletions

11
.gitattributes vendored
View File

@ -15,17 +15,6 @@
# These should also not be modified by git. # These should also not be modified by git.
tests/basics/string_cr_conversion.py -text tests/basics/string_cr_conversion.py -text
tests/basics/string_crlf_conversion.py -text tests/basics/string_crlf_conversion.py -text
stmhal/pybcdc.inf_template -text
stmhal/usbd_* -text
stmhal/boards/*/stm32f4xx_hal_conf.h -text
stmhal/usbdev/** -text
stmhal/usbhost/** -text
cc3200/hal/aes.c -text
cc3200/hal/aes.h -text
cc3200/hal/des.c -text
cc3200/hal/i2s.c -text
cc3200/hal/i2s.h -text
cc3200/version.h -text
ports/stm32/pybcdc.inf_template -text ports/stm32/pybcdc.inf_template -text
ports/stm32/usbd_* -text ports/stm32/usbd_* -text
ports/stm32/boards/*/stm32f4xx_hal_conf.h -text ports/stm32/boards/*/stm32f4xx_hal_conf.h -text

View File

@ -28,40 +28,40 @@ before_script:
script: script:
- make -C mpy-cross - make -C mpy-cross
- make -C minimal CROSS=1 build/firmware.bin - make -C ports/minimal CROSS=1 build/firmware.bin
- ls -l minimal/build/firmware.bin - ls -l ports/minimal/build/firmware.bin
- tools/check_code_size.sh - tools/check_code_size.sh
- mkdir -p ${HOME}/persist - mkdir -p ${HOME}/persist
# Save new firmware for reference, but only if building a main branch, not a pull request # Save new firmware for reference, but only if building a main branch, not a pull request
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp minimal/build/firmware.bin ${HOME}/persist/; fi' - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp ports/minimal/build/firmware.bin ${HOME}/persist/; fi'
- make -C unix deplibs - make -C ports/unix deplibs
- make -C unix - make -C ports/unix
- make -C unix nanbox - make -C ports/unix nanbox
- make -C bare-arm - make -C ports/bare-arm
- make -C qemu-arm test - make -C ports/qemu-arm test
- make -C stmhal - make -C ports/stm32
- make -C stmhal BOARD=PYBV11 MICROPY_PY_WIZNET5K=1 MICROPY_PY_CC3K=1 - make -C ports/stm32 BOARD=PYBV11 MICROPY_PY_WIZNET5K=1 MICROPY_PY_CC3K=1
- make -C stmhal BOARD=STM32F769DISC - make -C ports/stm32 BOARD=STM32F769DISC
- make -C stmhal BOARD=STM32L476DISC - make -C ports/stm32 BOARD=STM32L476DISC
- make -C teensy - make -C ports/teensy
- make -C cc3200 BTARGET=application BTYPE=release - make -C ports/cc3200 BTARGET=application BTYPE=release
- make -C cc3200 BTARGET=bootloader BTYPE=release - make -C ports/cc3200 BTARGET=bootloader BTYPE=release
- make -C windows CROSS_COMPILE=i686-w64-mingw32- - make -C ports/windows CROSS_COMPILE=i686-w64-mingw32-
# run tests without coverage info # run tests without coverage info
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests) #- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests)
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native) #- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native)
# run tests with coverage info # run tests with coverage info
- make -C unix coverage - make -C ports/unix coverage
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests) - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests -d thread) - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -d thread)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --emit native) - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --emit native)
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --via-mpy -d basics float) - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --via-mpy -d basics float)
# run coveralls coverage analysis (try to, even if some builds/tests failed) # run coveralls coverage analysis (try to, even if some builds/tests failed)
- (cd unix && coveralls --root .. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod) - (cd ports/unix && coveralls --root ../.. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
after_failure: after_failure:
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done) - (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)
- (grep "FAIL" qemu-arm/build/console.out) - (grep "FAIL" ports/qemu-arm/build/console.out)

View File

@ -34,10 +34,10 @@ Major components in this repository:
core library. core library.
- mpy-cross/ -- the MicroPython cross-compiler which is used to turn scripts - mpy-cross/ -- the MicroPython cross-compiler which is used to turn scripts
into precompiled bytecode. into precompiled bytecode.
- unix/ -- a version of MicroPython that runs on Unix. - ports/unix/ -- a version of MicroPython that runs on Unix.
- stmhal/ -- a version of MicroPython that runs on the PyBoard and similar - ports/stm32/ -- a version of MicroPython that runs on the PyBoard and similar
STM32 boards (using ST's Cube HAL drivers). STM32 boards (using ST's Cube HAL drivers).
- minimal/ -- a minimal MicroPython port. Start with this if you want - ports/minimal/ -- a minimal MicroPython port. Start with this if you want
to port MicroPython to another microcontroller. to port MicroPython to another microcontroller.
- tests/ -- test framework and test scripts. - tests/ -- test framework and test scripts.
- docs/ -- user documentation in Sphinx reStructuredText format. Rendered - docs/ -- user documentation in Sphinx reStructuredText format. Rendered
@ -45,13 +45,13 @@ Major components in this repository:
to select needed board/port at the bottom left corner). to select needed board/port at the bottom left corner).
Additional components: Additional components:
- bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used - ports/bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
mostly to control code size. mostly to control code size.
- teensy/ -- a version of MicroPython that runs on the Teensy 3.1 - ports/teensy/ -- a version of MicroPython that runs on the Teensy 3.1
(preliminary but functional). (preliminary but functional).
- pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers. - ports/pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
- cc3200/ -- a version of MicroPython that runs on the CC3200 from TI. - ports/cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
- esp8266/ -- an experimental port for ESP8266 WiFi modules. - ports/esp8266/ -- an experimental port for ESP8266 WiFi modules.
- extmod/ -- additional (non-core) modules implemented in C. - extmod/ -- additional (non-core) modules implemented in C.
- tools/ -- various tools, including the pyboard.py module. - tools/ -- various tools, including the pyboard.py module.
- examples/ -- a few example Python scripts. - examples/ -- a few example Python scripts.
@ -72,7 +72,7 @@ Alternatively, fallback implementation based on setjmp/longjmp can be used.
To build (see section below for required dependencies): To build (see section below for required dependencies):
$ cd unix $ cd ports/unix
$ make axtls $ make axtls
$ make $ make
@ -115,7 +115,7 @@ these additional dependencies, first fetch git submodules for them:
$ git submodule update --init $ git submodule update --init
Use this same command to get the latest versions of dependencies, as Use this same command to get the latest versions of dependencies, as
they are updated from time to time. After that, in `unix/` dir, execute: they are updated from time to time. After that, in `ports/unix/` dir, execute:
$ make deplibs $ make deplibs
@ -123,25 +123,25 @@ This will build all available dependencies (regardless whether they
are used or not). If you intend to build MicroPython with additional are used or not). If you intend to build MicroPython with additional
options (like cross-compiling), the same set of options should be passed options (like cross-compiling), the same set of options should be passed
to `make deplibs`. To actually enabled use of dependencies, edit to `make deplibs`. To actually enabled use of dependencies, edit
`unix/mpconfigport.mk` file, which has inline descriptions of the options. `ports/unix/mpconfigport.mk` file, which has inline descriptions of the options.
For example, to build SSL module (required for `upip` tool described above), For example, to build SSL module (required for `upip` tool described above),
set `MICROPY_PY_USSL` to 1. set `MICROPY_PY_USSL` to 1.
In `unix/mpconfigport.mk`, you can also disable some dependencies enabled In `ports/unix/mpconfigport.mk`, you can also disable some dependencies enabled
by default, like FFI support, which requires libffi development files to by default, like FFI support, which requires libffi development files to
be installed. be installed.
The STM version The STM32 version
--------------- -----------------
The "stmhal" port requires an ARM compiler, arm-none-eabi-gcc, and associated The "stm32" port requires an ARM compiler, arm-none-eabi-gcc, and associated
bin-utils. For those using Arch Linux, you need arm-none-eabi-binutils and bin-utils. For those using Arch Linux, you need arm-none-eabi-binutils and
arm-none-eabi-gcc packages. Otherwise, try here: arm-none-eabi-gcc packages. Otherwise, try here:
https://launchpad.net/gcc-arm-embedded https://launchpad.net/gcc-arm-embedded
To build: To build:
$ cd stmhal $ cd ports/stm32
$ make $ make
You then need to get your board into DFU mode. On the pyboard, connect the 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:
This will use the included `tools/pydfu.py` script. If flashing the firmware This will use the included `tools/pydfu.py` script. If flashing the firmware
does not work it may be because you don't have the correct permissions, and does not work it may be because you don't have the correct permissions, and
need to use `sudo make deploy`. need to use `sudo make deploy`.
See the README.md file in the stmhal/ directory for further details. See the README.md file in the ports/stm32/ directory for further details.

View File

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

View File

@ -1,5 +1,5 @@
# Print a nice list of pins, their current settings, and available afs. # Print a nice list of pins, their current settings, and available afs.
# Requires pins_af.py from stmhal/build-PYBV10/ directory. # Requires pins_af.py from ports/stm32/build-PYBV10/ directory.
import pyb import pyb
import pins_af import pins_af

View File

@ -33,7 +33,7 @@
#if MICROPY_PY_FRAMEBUF #if MICROPY_PY_FRAMEBUF
#include "stmhal/font_petme128_8x8.h" #include "ports/stm32/font_petme128_8x8.h"
typedef struct _mp_obj_framebuf_t { typedef struct _mp_obj_framebuf_t {
mp_obj_base_t base; mp_obj_base_t base;

View File

@ -65,7 +65,7 @@ SRC_C = \
# Add fmode when compiling with mingw gcc # Add fmode when compiling with mingw gcc
COMPILER_TARGET := $(shell $(CC) -dumpmachine) COMPILER_TARGET := $(shell $(CC) -dumpmachine)
ifneq (,$(findstring mingw,$(COMPILER_TARGET))) ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
SRC_C += windows/fmode.c SRC_C += ports/windows/fmode.c
endif endif
OBJ = $(PY_O) OBJ = $(PY_O)

View File

@ -36,7 +36,7 @@
#include "py/gc.h" #include "py/gc.h"
#include "py/stackctrl.h" #include "py/stackctrl.h"
#ifdef _WIN32 #ifdef _WIN32
#include "windows/fmode.h" #include "ports/windows/fmode.h"
#endif #endif
// Command line options, with their defaults // Command line options, with their defaults

View File

@ -1,4 +1,4 @@
include ../py/mkenv.mk include ../../py/mkenv.mk
# qstr definitions (must come before including py.mk) # qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h QSTR_DEFS = qstrdefsport.h

View File

@ -14,7 +14,7 @@ PORT ?= /dev/ttyUSB1
# If the build directory is not given, make it reflect the board name. # If the build directory is not given, make it reflect the board name.
BUILD ?= build/$(BOARD)/$(BTYPE) BUILD ?= build/$(BOARD)/$(BTYPE)
include ../py/mkenv.mk include ../../py/mkenv.mk
-include ../../localconfig.mk -include ../../localconfig.mk
CROSS_COMPILE ?= arm-none-eabi- CROSS_COMPILE ?= arm-none-eabi-

View File

@ -18,7 +18,7 @@ APP_INC += -Iutil
APP_INC += -Ibootmgr APP_INC += -Ibootmgr
APP_INC += -I$(BUILD) APP_INC += -I$(BUILD)
APP_INC += -I$(BUILD)/genhdr APP_INC += -I$(BUILD)/genhdr
APP_INC += -I$(TOP)/stmhal APP_INC += -I$(TOP)/ports/stm32
APP_CPPDEFINES = -Dgcc -DTARGET_IS_CC3200 -DSL_FULL -DUSE_FREERTOS APP_CPPDEFINES = -Dgcc -DTARGET_IS_CC3200 -DSL_FULL -DUSE_FREERTOS
@ -151,7 +151,7 @@ APP_LIB_SRC_C = $(addprefix lib/,\
utils/sys_stdio_mphal.c \ utils/sys_stdio_mphal.c \
) )
APP_STM_SRC_C = $(addprefix stmhal/,\ APP_STM_SRC_C = $(addprefix ports/stm32/,\
bufhelper.c \ bufhelper.c \
irq.c \ irq.c \
) )

View File

@ -98,7 +98,7 @@ $(BUILD)/misc/%.o: CFLAGS += -Os
$(BUILD)/simplelink/%.o: CFLAGS += -Os $(BUILD)/simplelink/%.o: CFLAGS += -Os
$(BUILD)/drivers/cc3100/%.o: CFLAGS += -Os $(BUILD)/drivers/cc3100/%.o: CFLAGS += -Os
$(BUILD)/py/%.o: CFLAGS += -Os $(BUILD)/py/%.o: CFLAGS += -Os
$(BUILD)/stmhal/%.o: CFLAGS += -Os $(BUILD)/ports/stm32/%.o: CFLAGS += -Os
else else
$(error Invalid BTYPE specified) $(error Invalid BTYPE specified)
endif endif

View File

@ -1,4 +1,4 @@
include ../py/mkenv.mk include ../../py/mkenv.mk
# qstr definitions (must come before including py.mk) # qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h #$(BUILD)/pins_qstr.h QSTR_DEFS = qstrdefsport.h #$(BUILD)/pins_qstr.h

View File

@ -72,7 +72,7 @@ void ets_event_poll(void);
// C-level pin HAL // C-level pin HAL
#include "etshal.h" #include "etshal.h"
#include "gpio.h" #include "gpio.h"
#include "esp8266/modmachine.h" #include "modmachine.h"
#define MP_HAL_PIN_FMT "%u" #define MP_HAL_PIN_FMT "%u"
#define mp_hal_pin_obj_t uint32_t #define mp_hal_pin_obj_t uint32_t
#define mp_hal_get_pin_obj(o) mp_obj_get_pin(o) #define mp_hal_get_pin_obj(o) mp_obj_get_pin(o)

View File

@ -1 +1 @@
../../drivers/onewire/ds18x20.py ../../../drivers/onewire/ds18x20.py

View File

@ -1 +1 @@
../../drivers/onewire/onewire.py ../../../drivers/onewire/onewire.py

View File

@ -1 +1 @@
../../tools/upip.py ../../../tools/upip.py

View File

@ -1 +1 @@
../../tools/upip_utarfile.py ../../../tools/upip_utarfile.py

View File

@ -1,4 +1,4 @@
include ../py/mkenv.mk include ../../py/mkenv.mk
CROSS = 0 CROSS = 0

View File

@ -1,4 +1,4 @@
include ../py/mkenv.mk include ../../py/mkenv.mk
# qstr definitions (must come before including py.mk) # qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h QSTR_DEFS = qstrdefsport.h

View File

@ -1,4 +1,4 @@
include ../py/mkenv.mk include ../../py/mkenv.mk
-include mpconfigport.mk -include mpconfigport.mk
# qstr definitions (must come before including py.mk) # qstr definitions (must come before including py.mk)

View File

@ -8,7 +8,7 @@ endif
# If the build directory is not given, make it reflect the board name. # If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD) BUILD ?= build-$(BOARD)
include ../py/mkenv.mk include ../../py/mkenv.mk
-include mpconfigport.mk -include mpconfigport.mk
include boards/$(BOARD)/mpconfigboard.mk include boards/$(BOARD)/mpconfigboard.mk
@ -206,7 +206,7 @@ SRC_C = \
timer.c \ timer.c \
led.c \ led.c \
pin.c \ pin.c \
pin_defs_stmhal.c \ pin_defs_stm32.c \
pin_named_pins.c \ pin_named_pins.c \
bufhelper.c \ bufhelper.c \
dma.c \ dma.c \

View File

@ -24,7 +24,7 @@ bytecode. The cross-compiler is built and run on the host machine, using:
$ make -C mpy-cross $ make -C mpy-cross
``` ```
This command should be executed from the root directory of this repository. This command should be executed from the root directory of this repository.
All other commands below should be executed from the stmhal/ directory. All other commands below should be executed from the ports/stm32/ directory.
An ARM compiler is required for the build, along with the associated binary An ARM compiler is required for the build, along with the associated binary
utilities. The default compiler is `arm-none-eabi-gcc`, which is available for utilities. The default compiler is `arm-none-eabi-gcc`, which is available for
@ -71,7 +71,7 @@ Or using `dfu-util` directly:
ST Discovery or Nucleo boards have a builtin programmer called ST-LINK. With ST Discovery or Nucleo boards have a builtin programmer called ST-LINK. With
these boards and using Linux or OS X, you have the option to upload the these boards and using Linux or OS X, you have the option to upload the
`stmhal` firmware using the `st-flash` utility from the `stm32` firmware using the `st-flash` utility from the
[stlink](https://github.com/texane/stlink) project. To do so, connect the board [stlink](https://github.com/texane/stlink) project. To do so, connect the board
with a mini USB cable to its ST-LINK USB port and then use the make target with a mini USB cable to its ST-LINK USB port and then use the make target
`deploy-stlink`. For example, if you have the STM32F4DISCOVERY board, you can `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
$ make BOARD=STM32F4DISC deploy-openocd $ make BOARD=STM32F4DISC deploy-openocd
The `openocd` program, which writes the firmware to the target board's flash, The `openocd` program, which writes the firmware to the target board's flash,
is configured via the file `stmhal/boards/openocd_stm32f4.cfg`. This is configured via the file `ports/stm32/boards/openocd_stm32f4.cfg`. This
configuration should work for all boards based on a STM32F4xx MCU with a configuration should work for all boards based on a STM32F4xx MCU with a
ST-LINKv2 interface. You can override the path to this configuration by setting ST-LINKv2 interface. You can override the path to this configuration by setting
`OPENOCD_CONFIG` in your Makefile or on the command line. `OPENOCD_CONFIG` in your Makefile or on the command line.

View File

@ -46,7 +46,7 @@
/* Exported types ------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/
// This board doesn't really have USB, but the stmhal codebase doesn't build // This board doesn't really have USB, but the stm32 codebase doesn't build
// without some USB defined, so we leave this on for now. // without some USB defined, so we leave this on for now.
#define USE_USB_FS #define USE_USB_FS

View File

@ -46,7 +46,7 @@
/* Exported types ------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/
// This board doesn't really have USB, but the stmhal codebase doesn't build // This board doesn't really have USB, but the stm32 codebase doesn't build
// without some USB defined, so we leave this on for now. // without some USB defined, so we leave this on for now.
#define USE_USB_FS #define USE_USB_FS

View File

@ -46,7 +46,7 @@
/* Exported types ------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/
// This board doesn't really have USB, but the stmhal codebase doesn't build // This board doesn't really have USB, but the stm32 codebase doesn't build
// without some USB defined, so we leave this on for now. // without some USB defined, so we leave this on for now.
#define USE_USB_FS #define USE_USB_FS

View File

@ -26,7 +26,7 @@
#include "py/builtin.h" #include "py/builtin.h"
const char *stmhal_help_text = const char *stm32_help_text =
"Welcome to MicroPython!\n" "Welcome to MicroPython!\n"
"\n" "\n"
"For online help please visit http://micropython.org/help/.\n" "For online help please visit http://micropython.org/help/.\n"

View File

@ -1 +1 @@
../../drivers/display/lcd160cr.py ../../../drivers/display/lcd160cr.py

View File

@ -1 +1 @@
../../drivers/display/lcd160cr_test.py ../../../drivers/display/lcd160cr_test.py

View File

@ -1 +1 @@
../../drivers/onewire/onewire.py ../../../drivers/onewire/onewire.py

View File

@ -92,7 +92,7 @@
#define MICROPY_PY_BUILTINS_INPUT (1) #define MICROPY_PY_BUILTINS_INPUT (1)
#define MICROPY_PY_BUILTINS_POW3 (1) #define MICROPY_PY_BUILTINS_POW3 (1)
#define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_TEXT stmhal_help_text #define MICROPY_PY_BUILTINS_HELP_TEXT stm32_help_text
#define MICROPY_PY_BUILTINS_HELP_MODULES (1) #define MICROPY_PY_BUILTINS_HELP_MODULES (1)
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1) #define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
@ -345,4 +345,4 @@ static inline mp_uint_t disable_irq(void) {
// We need to provide a declaration/definition of alloca() // We need to provide a declaration/definition of alloca()
#include <alloca.h> #include <alloca.h>
#define MICROPY_PIN_DEFS_PORT_H "pin_defs_stmhal.h" #define MICROPY_PIN_DEFS_PORT_H "pin_defs_stm32.h"

View File

@ -27,7 +27,7 @@ void mp_hal_set_interrupt_char(int c); // -1 to disable
// timing functions // timing functions
#include "stmhal/irq.h" #include "irq.h"
#define mp_hal_quiet_timing_enter() raise_irq_pri(1) #define mp_hal_quiet_timing_enter() raise_irq_pri(1)
#define mp_hal_quiet_timing_exit(irq_state) restore_irq_pri(irq_state) #define mp_hal_quiet_timing_exit(irq_state) restore_irq_pri(irq_state)
@ -44,7 +44,7 @@ static inline mp_uint_t mp_hal_ticks_cpu(void) {
// C-level pin HAL // C-level pin HAL
#include "stmhal/pin.h" #include "pin.h"
#define MP_HAL_PIN_FMT "%q" #define MP_HAL_PIN_FMT "%q"
#define MP_HAL_PIN_MODE_INPUT (0) #define MP_HAL_PIN_MODE_INPUT (0)

View File

@ -24,7 +24,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
// This file contains pin definitions that are specific to the stmhal port. // This file contains pin definitions that are specific to the stm32 port.
// This file should only ever be #included by pin.h and not directly. // This file should only ever be #included by pin.h and not directly.
enum { enum {

View File

@ -1,4 +1,4 @@
include ../py/mkenv.mk include ../../py/mkenv.mk
# qstr definitions (must come before including py.mk) # qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
@ -31,7 +31,7 @@ CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -msoft-float -mfloat
INC += -I. INC += -I.
INC += -I$(TOP) INC += -I$(TOP)
INC += -I$(TOP)/stmhal INC += -I$(TOP)/ports/stm32
INC += -I$(BUILD) INC += -I$(BUILD)
INC += -Icore INC += -Icore
@ -91,14 +91,14 @@ SRC_C = \
uart.c \ uart.c \
usb.c \ usb.c \
STM_SRC_C = $(addprefix stmhal/,\ STM_SRC_C = $(addprefix ports/stm32/,\
gccollect.c \ gccollect.c \
irq.c \ irq.c \
pin.c \ pin.c \
pin_named_pins.c \ pin_named_pins.c \
) )
STM_SRC_S = $(addprefix stmhal/,\ STM_SRC_S = $(addprefix ports/stm32/,\
gchelper.s \ gchelper.s \
) )

View File

@ -1,5 +1,5 @@
#include "py/obj.h" #include "py/obj.h"
#include "../stmhal/lcd.h" #include "../stm32/lcd.h"
void lcd_init(void) { void lcd_init(void) {
} }

View File

@ -1,5 +1,5 @@
-include mpconfigport.mk -include mpconfigport.mk
include ../py/mkenv.mk include ../../py/mkenv.mk
FROZEN_DIR = scripts FROZEN_DIR = scripts
FROZEN_MPY_DIR = modules FROZEN_MPY_DIR = modules
@ -188,7 +188,7 @@ include $(TOP)/py/mkrules.mk
.PHONY: test .PHONY: test
test: $(PROG) $(TOP)/tests/run-tests test: $(PROG) $(TOP)/tests/run-tests
$(eval DIRNAME=$(notdir $(CURDIR))) $(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
# install micropython in /usr/local/bin # install micropython in /usr/local/bin
@ -253,7 +253,7 @@ coverage:
BUILD=build-coverage PROG=micropython_coverage BUILD=build-coverage PROG=micropython_coverage
coverage_test: coverage coverage_test: coverage
$(eval DIRNAME=$(notdir $(CURDIR))) $(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests -d thread cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests -d thread
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --emit native cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --emit native

View File

@ -1 +1 @@
../../tools/upip.py ../../../tools/upip.py

View File

@ -1 +1 @@
../../tools/upip_utarfile.py ../../../tools/upip_utarfile.py

View File

@ -15,7 +15,7 @@ platform:
- x64 - x64
build: build:
project: windows/micropython.vcxproj project: ports/windows/micropython.vcxproj
verbosity: normal verbosity: normal
test_script: test_script:

View File

@ -1,4 +1,4 @@
include ../py/mkenv.mk include ../../py/mkenv.mk
-include mpconfigport.mk -include mpconfigport.mk
# define main target # define main target
@ -28,13 +28,13 @@ endif
# source files # source files
SRC_C = \ SRC_C = \
unix/main.c \ ports/unix/main.c \
unix/file.c \ ports/unix/file.c \
unix/input.c \ ports/unix/input.c \
unix/modos.c \ ports/unix/modos.c \
unix/modmachine.c \ ports/unix/modmachine.c \
unix/modtime.c \ ports/unix/modtime.c \
unix/gccollect.c \ ports/unix/gccollect.c \
windows_mphal.c \ windows_mphal.c \
realpath.c \ realpath.c \
init.c \ init.c \

View File

@ -50,8 +50,8 @@ __Stack usage__
The msvc compiler is quite stack-hungry which might result in a "maximum recursion depth exceeded" The msvc compiler is quite stack-hungry which might result in a "maximum recursion depth exceeded"
RuntimeError for code with lots of nested function calls. RuntimeError for code with lots of nested function calls.
There are several ways to deal with this: There are several ways to deal with this:
- increase the threshold used for detection by altering the argument to `mp_stack_set_limit` in `unix/main.c` - increase the threshold used for detection by altering the argument to `mp_stack_set_limit` in `ports/unix/main.c`
- disable detection all together by setting `MICROPY_STACK_CHECK` to "0" in `windows/mpconfigport.h` - disable detection all together by setting `MICROPY_STACK_CHECK` to "0" in `ports/windows/mpconfigport.h`
- disable the /GL compiler flag by setting `WholeProgramOptimization` to "false" - disable the /GL compiler flag by setting `WholeProgramOptimization` to "false"
See [issue 2927](https://github.com/micropython/micropython/issues/2927) for more information. See [issue 2927](https://github.com/micropython/micropython/issues/2927) for more information.

View File

@ -10,7 +10,7 @@
<PropertyGroup> <PropertyGroup>
<DestDir>$(PyBuildDir)genhdr\</DestDir> <DestDir>$(PyBuildDir)genhdr\</DestDir>
<PySrcDir>$(PyBaseDir)py\</PySrcDir> <PySrcDir>$(PyBaseDir)py\</PySrcDir>
<QstrDefs>$(PyBaseDir)unix\qstrdefsport.h</QstrDefs> <QstrDefs>$(PyBaseDir)ports\unix\qstrdefsport.h</QstrDefs>
<PyQstrDefs>$(PySrcDir)qstrdefs.h</PyQstrDefs> <PyQstrDefs>$(PySrcDir)qstrdefs.h</PyQstrDefs>
<QstrDefsCollected>$(DestDir)qstrdefscollected.h</QstrDefsCollected> <QstrDefsCollected>$(DestDir)qstrdefscollected.h</QstrDefsCollected>
<QstrGen>$(DestDir)qstrdefs.generated.h</QstrGen> <QstrGen>$(DestDir)qstrdefs.generated.h</QstrGen>

View File

@ -3,28 +3,28 @@
<PropertyGroup> <PropertyGroup>
<PyPathsIncluded>True</PyPathsIncluded> <PyPathsIncluded>True</PyPathsIncluded>
<!-- The properties below specify the output directory structure. <!-- The properties below specify the directory structure.
This defaults to, for example for Configuration = Debug and Platform = x64: This defaults to, for example for Configuration = Debug and Platform = x64:
micropython [PyBaseDir] micropython [PyBaseDir]
|- ... |- ...
|- windows [PyWinDir] |- ports/windows [PyWinDir]
|- ... |- ...
|- micropython.exe |- micropython.exe
|- build [PyBuildDir] |- build [PyBuildDir]
|- Debugx64 [PyOutDir] |- Debugx64 [PyOutDir]
| |- ... | |- ...
| |- micropython.exe | |- micropython.exe
| |- micropython.map | |- micropython.map
| |- obj [PyIntDir] | |- obj [PyIntDir]
|- genhdr |- genhdr
Note that the micropython executable will be copied from PyOutDir Note that the micropython executable will be copied from PyOutDir
to PyWinDir after each build. --> to PyWinDir after each build. -->
<!-- Start from project root --> <!-- Start from project root -->
<PyBaseDir>$([System.IO.Path]::GetFullPath(`$(MSBuildThisFileDirectory)..\..`))\</PyBaseDir> <PyBaseDir>$([System.IO.Path]::GetFullPath(`$(MSBuildThisFileDirectory)..\..\..`))\</PyBaseDir>
<PyWinDir>$(PyBaseDir)windows\</PyWinDir> <PyWinDir>$(PyBaseDir)ports\windows\</PyWinDir>
<PyBuildDir Condition="'$(PyBuildDir)' == ''">$(PyWinDir)build\</PyBuildDir> <PyBuildDir Condition="'$(PyBuildDir)' == ''">$(PyWinDir)build\</PyBuildDir>
<!-- All include directories needed for uPy --> <!-- All include directories needed for uPy -->

View File

@ -3,16 +3,16 @@
<Import Project="paths.props" Condition="'$(PyPathsIncluded)' != 'True'"/> <Import Project="paths.props" Condition="'$(PyPathsIncluded)' != 'True'"/>
<ItemGroup> <ItemGroup>
<ClCompile Include="$(PyBaseDir)py\*.c" /> <ClCompile Include="$(PyBaseDir)py\*.c" />
<ClCompile Include="$(PyBaseDir)windows\*.c" /> <ClCompile Include="$(PyBaseDir)ports\windows\*.c" />
<ClCompile Include="$(PyBaseDir)windows\msvc\*.c" /> <ClCompile Include="$(PyBaseDir)ports\windows\msvc\*.c" />
<ClCompile Include="$(PyBaseDir)lib\mp-readline\*.c" /> <ClCompile Include="$(PyBaseDir)lib\mp-readline\*.c" />
<ClCompile Include="$(PyBaseDir)unix\file.c"/> <ClCompile Include="$(PyBaseDir)ports\unix\file.c"/>
<ClCompile Include="$(PyBaseDir)unix\gccollect.c"/> <ClCompile Include="$(PyBaseDir)ports\unix\gccollect.c"/>
<ClCompile Include="$(PyBaseDir)unix\input.c"/> <ClCompile Include="$(PyBaseDir)ports\unix\input.c"/>
<ClCompile Include="$(PyBaseDir)unix\main.c"/> <ClCompile Include="$(PyBaseDir)ports\unix\main.c"/>
<ClCompile Include="$(PyBaseDir)unix\modos.c"/> <ClCompile Include="$(PyBaseDir)ports\unix\modos.c"/>
<ClCompile Include="$(PyBaseDir)unix\modtime.c"/> <ClCompile Include="$(PyBaseDir)ports\unix\modtime.c"/>
<ClCompile Include="$(PyBaseDir)unix\modmachine.c" /> <ClCompile Include="$(PyBaseDir)ports\unix\modmachine.c" />
<ClCompile Include="$(PyBaseDir)extmod\machine_mem.c" /> <ClCompile Include="$(PyBaseDir)extmod\machine_mem.c" />
<ClCompile Include="$(PyBaseDir)extmod\machine_pinbase.c" /> <ClCompile Include="$(PyBaseDir)extmod\machine_pinbase.c" />
<ClCompile Include="$(PyBaseDir)extmod\machine_pulse.c" /> <ClCompile Include="$(PyBaseDir)extmod\machine_pulse.c" />
@ -31,7 +31,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="$(PyBaseDir)py\*.h" /> <ClInclude Include="$(PyBaseDir)py\*.h" />
<ClInclude Include="$(PyBaseDir)windows\*.h" /> <ClInclude Include="$(PyBaseDir)ports\windows\*.h" />
<ClInclude Include="$(PyBaseDir)windows\msvc\*.h" /> <ClInclude Include="$(PyBaseDir)ports\windows\msvc\*.h" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -25,7 +25,7 @@
*/ */
#include "sleep.h" #include "sleep.h"
#include "unix/mphalport.h" #include "ports/unix/mphalport.h"
#define MICROPY_HAL_HAS_VT100 (0) #define MICROPY_HAL_HAS_VT100 (0)

View File

@ -26,7 +26,7 @@ ifneq ($(MAKECMDGOALS), clean)
include $(Z_EXPORTS) include $(Z_EXPORTS)
endif endif
include ../py/mkenv.mk include ../../py/mkenv.mk
include $(TOP)/py/py.mk include $(TOP)/py/py.mk
INC += -I. INC += -I.

View File

@ -103,7 +103,7 @@ endif
ifneq ($(FROZEN_MPY_DIR),) ifneq ($(FROZEN_MPY_DIR),)
# to build the MicroPython cross compiler # to build the MicroPython cross compiler
$(TOP)/mpy-cross/mpy-cross: $(TOP)/py/*.[ch] $(TOP)/mpy-cross/*.[ch] $(TOP)/windows/fmode.c $(TOP)/mpy-cross/mpy-cross: $(TOP)/py/*.[ch] $(TOP)/mpy-cross/*.[ch] $(TOP)/ports/windows/fmode.c
$(Q)$(MAKE) -C $(TOP)/mpy-cross $(Q)$(MAKE) -C $(TOP)/mpy-cross
# make a list of all the .py files that need compiling and freezing # make a list of all the .py files that need compiling and freezing

View File

@ -13,10 +13,10 @@ from glob import glob
# to the correct executable. # to the correct executable.
if os.name == 'nt': if os.name == 'nt':
CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe')
MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../windows/micropython.exe') MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe')
else: else:
CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3')
MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../unix/micropython') MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython')
# mpy-cross is only needed if --via-mpy command-line arg is passed # mpy-cross is only needed if --via-mpy command-line arg is passed
MPYCROSS = os.getenv('MICROPY_MPYCROSS', '../mpy-cross/mpy-cross') MPYCROSS = os.getenv('MICROPY_MPYCROSS', '../mpy-cross/mpy-cross')

View File

@ -10,7 +10,7 @@ REFERENCE=$HOME/persist/firmware.bin
if [ -f $REFERENCE ]; then if [ -f $REFERENCE ]; then
size_old=$(stat -c%s $REFERENCE) size_old=$(stat -c%s $REFERENCE)
size_new=$(stat -c%s minimal/build/firmware.bin) size_new=$(stat -c%s ports/minimal/build/firmware.bin)
echo "Old size: $size_old new size: $size_new" echo "Old size: $size_old new size: $size_new"
if [ $size_new -gt $size_old ]; then if [ $size_new -gt $size_old ]; then
echo "Validation failure: Core code size increased" echo "Validation failure: Core code size increased"

View File

@ -9,7 +9,7 @@
# executing because it does not exist in old revisions of the repository. # executing because it does not exist in old revisions of the repository.
# check that we are in the root directory of the repository # check that we are in the root directory of the repository
if [ ! -d py -o ! -d unix -o ! -d stmhal ]; then if [ ! -d py -o ! -d ports/unix -o ! -d ports/stm32 ]; then
echo "script must be run from root of the repository" echo "script must be run from root of the repository"
exit 1 exit 1
fi fi
@ -23,18 +23,18 @@ AWK=awk
MAKE="make -j2" MAKE="make -j2"
# these are the binaries that are built; some have 2 or 3 depending on version # these are the binaries that are built; some have 2 or 3 depending on version
bin_unix=unix/micropython bin_unix=ports/unix/micropython
bin_stmhal=stmhal/build-PYBV10/firmware.elf bin_stm32=ports/stm32/build-PYBV10/firmware.elf
bin_barearm_1=bare-arm/build/flash.elf bin_barearm_1=ports/bare-arm/build/flash.elf
bin_barearm_2=bare-arm/build/firmware.elf bin_barearm_2=ports/bare-arm/build/firmware.elf
bin_minimal=minimal/build/firmware.elf bin_minimal=ports/minimal/build/firmware.elf
bin_cc3200_1=cc3200/build/LAUNCHXL/application.axf bin_cc3200_1=ports/cc3200/build/LAUNCHXL/application.axf
bin_cc3200_2=cc3200/build/LAUNCHXL/release/application.axf bin_cc3200_2=ports/cc3200/build/LAUNCHXL/release/application.axf
bin_cc3200_3=cc3200/build/WIPY/release/application.axf bin_cc3200_3=ports/cc3200/build/WIPY/release/application.axf
# start at zero size; if build fails reuse previous valid size # start at zero size; if build fails reuse previous valid size
size_unix="0" size_unix="0"
size_stmhal="0" size_stm32="0"
size_barearm="0" size_barearm="0"
size_minimal="0" size_minimal="0"
size_cc3200="0" size_cc3200="0"
@ -86,7 +86,7 @@ function get_size3() {
if [ -r $output ]; then if [ -r $output ]; then
last_rev=$(tail -n1 $output | $AWK '{print $1}') last_rev=$(tail -n1 $output | $AWK '{print $1}')
else else
echo "# hash size_unix size_stmhal size_barearm size_minimal size_cc3200 pystones" > $output echo "# hash size_unix size_stm32 size_barearm size_minimal size_cc3200 pystones" > $output
last_rev="v1.0" last_rev="v1.0"
fi fi
@ -132,37 +132,37 @@ EOF
#### unix #### #### unix ####
$RM $bin_unix $RM $bin_unix
$MAKE -C unix CFLAGS_EXTRA=-DNDEBUG $MAKE -C ports/unix CFLAGS_EXTRA=-DNDEBUG
size_unix=$(get_size $size_unix $bin_unix) size_unix=$(get_size $size_unix $bin_unix)
# undo patch if it was applied # undo patch if it was applied
git checkout unix/modtime.c git checkout unix/modtime.c
#### stmhal #### #### stm32 ####
$RM $bin_stmhal $RM $bin_stm32
$MAKE -C stmhal board=PYBV10 $MAKE -C ports/stm32 board=PYBV10
size_stmhal=$(get_size $size_stmhal $bin_stmhal) size_stm32=$(get_size $size_stm32 $bin_stm32)
#### bare-arm #### #### bare-arm ####
$RM $bin_barearm_1 $bin_barearm_2 $RM $bin_barearm_1 $bin_barearm_2
$MAKE -C bare-arm $MAKE -C ports/bare-arm
size_barearm=$(get_size2 $size_barearm $bin_barearm_1 $bin_barearm_2) size_barearm=$(get_size2 $size_barearm $bin_barearm_1 $bin_barearm_2)
#### minimal #### #### minimal ####
if [ -r minimal/Makefile ]; then if [ -r ports/minimal/Makefile ]; then
$RM $bin_minimal $RM $bin_minimal
$MAKE -C minimal CROSS=1 $MAKE -C ports/minimal CROSS=1
size_minimal=$(get_size $size_minimal $bin_minimal) size_minimal=$(get_size $size_minimal $bin_minimal)
fi fi
#### cc3200 #### #### cc3200 ####
if [ -r cc3200/Makefile ]; then if [ -r ports/cc3200/Makefile ]; then
$RM $bin_cc3200_1 $bin_cc3200_2 $bin_cc3200_3 $RM $bin_cc3200_1 $bin_cc3200_2 $bin_cc3200_3
$MAKE -C cc3200 BTARGET=application $MAKE -C ports/cc3200 BTARGET=application
size_cc3200=$(get_size3 $size_cc3200 $bin_cc3200_1 $bin_cc3200_2 $bin_cc3200_3) size_cc3200=$(get_size3 $size_cc3200 $bin_cc3200_1 $bin_cc3200_2 $bin_cc3200_3)
fi fi
@ -178,7 +178,7 @@ EOF
#### output data for this commit #### #### output data for this commit ####
echo "$hash $size_unix $size_stmhal $size_barearm $size_minimal $size_cc3200 $pystones" >> $output echo "$hash $size_unix $size_stm32 $size_barearm $size_minimal $size_cc3200 $pystones" >> $output
done done