Merge pull request #3157 from hathach/update-buildsystem
Update buildsystem
This commit is contained in:
@@ -19,13 +19,12 @@ jobs:
|
||||
echo "MATRIX_JSON=$MATRIX_JSON"
|
||||
|
||||
BUILDSYSTEM_TOOLCHAIN=(
|
||||
"cmake aarch64-gcc"
|
||||
"cmake arm-clang"
|
||||
"cmake arm-gcc"
|
||||
"cmake esp-idf"
|
||||
"make aarch64-gcc"
|
||||
"make arm-gcc"
|
||||
"make msp430-gcc"
|
||||
"make riscv-gcc"
|
||||
"make rx-gcc"
|
||||
"cmake msp430-gcc"
|
||||
"cmake riscv-gcc"
|
||||
)
|
||||
|
||||
# only build IAR if not forked PR, since IAR token is not shared
|
||||
@@ -67,7 +66,7 @@ jobs:
|
||||
FAMILY_LARGE=$(jq -n --argjson family "$FAMILY" --argjson resource "$RESOURCE_LARGE" '$family | map(select(IN($resource[])))')
|
||||
FAMILY=$(jq -n --argjson family "$FAMILY" --argjson resource "$RESOURCE_LARGE" '$family | map(select(IN($resource[]) | not))')
|
||||
|
||||
if [[ $toolchain == esp-idf ]]; then
|
||||
if [[ $toolchain == esp-idf || $toolchain == arm-iar ]]; then
|
||||
gen_build_entry "$build_system" "$toolchain" "$FAMILY" "large"
|
||||
else
|
||||
gen_build_entry "$build_system" "$toolchain" "$FAMILY" "medium+"
|
||||
|
60
.github/workflows/build.yml
vendored
60
.github/workflows/build.yml
vendored
@@ -36,11 +36,6 @@ env:
|
||||
HIL_JSON: test/hil/tinyusb.json
|
||||
|
||||
jobs:
|
||||
# ---------------------------------------
|
||||
#
|
||||
# Build
|
||||
#
|
||||
# ---------------------------------------
|
||||
set-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
@@ -63,28 +58,31 @@ jobs:
|
||||
echo "hil_matrix=$HIL_MATRIX_JSON" >> $GITHUB_OUTPUT
|
||||
|
||||
# ---------------------------------------
|
||||
# Build CMake
|
||||
# Build CMake: only build on push with one-per-family.
|
||||
# Full built is done by CircleCI in PR
|
||||
# ---------------------------------------
|
||||
cmake:
|
||||
if: github.event_name == 'push'
|
||||
needs: set-matrix
|
||||
uses: ./.github/workflows/build_util.yml
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolchain:
|
||||
# - 'arm-clang' is built by circle-ci in PR
|
||||
- 'aarch64-gcc'
|
||||
#- 'arm-clang'
|
||||
- 'arm-gcc'
|
||||
- 'esp-idf'
|
||||
- 'msp430-gcc'
|
||||
- 'riscv-gcc'
|
||||
with:
|
||||
build-system: 'cmake'
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
|
||||
one-per-family: ${{ github.event_name == 'push' }}
|
||||
one-per-family: true
|
||||
|
||||
# ---------------------------------------
|
||||
# Build Make (built by circle-ci in PR, only build on push here)
|
||||
# Build Make: only build on push with one-per-family
|
||||
# ---------------------------------------
|
||||
make:
|
||||
if: github.event_name == 'push'
|
||||
@@ -94,36 +92,18 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolchain:
|
||||
# 'arm-clang'
|
||||
- 'arm-gcc'
|
||||
- 'aarch64-gcc'
|
||||
#- 'arm-clang'
|
||||
- 'arm-gcc'
|
||||
- 'msp430-gcc'
|
||||
- 'riscv-gcc'
|
||||
- 'rx-gcc'
|
||||
- 'esp-idf'
|
||||
with:
|
||||
build-system: 'make'
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
|
||||
one-per-family: true
|
||||
|
||||
# ---------------------------------------
|
||||
# Build Make on Windows/MacOS
|
||||
# ---------------------------------------
|
||||
make-os:
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: ./.github/workflows/build_util.yml
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, macos-latest]
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
build-system: 'make'
|
||||
toolchain: 'arm-gcc'
|
||||
build-args: '["stm32h7"]'
|
||||
one-per-family: true
|
||||
|
||||
# ---------------------------------------
|
||||
# Build IAR
|
||||
# Since IAR Token secret is not passed to forked PR, only build non-forked PR with make.
|
||||
@@ -146,6 +126,23 @@ jobs:
|
||||
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)['arm-iar']) }}
|
||||
one-per-family: true
|
||||
|
||||
# ---------------------------------------
|
||||
# Build Make on Windows/MacOS
|
||||
# ---------------------------------------
|
||||
make-os:
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: ./.github/workflows/build_util.yml
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, macos-latest]
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
build-system: 'make'
|
||||
toolchain: 'arm-gcc'
|
||||
build-args: '["stm32h7"]'
|
||||
one-per-family: true
|
||||
|
||||
# ---------------------------------------
|
||||
# Zephyr
|
||||
# ---------------------------------------
|
||||
@@ -168,14 +165,9 @@ jobs:
|
||||
west build -b pca10056 -d examples/device/msc_dual_lun/build examples/device/msc_dual_lun -- -DRTOS=zephyr
|
||||
|
||||
# ---------------------------------------
|
||||
#
|
||||
# Hardware in the loop (HIL)
|
||||
# Run on PR only (hil-tinyusb), hil-hfp only run on non-forked PR
|
||||
# ---------------------------------------
|
||||
|
||||
# ---------------------------------------
|
||||
# Build arm-gcc
|
||||
# ---------------------------------------
|
||||
hil-build:
|
||||
if: |
|
||||
github.repository_owner == 'hathach' &&
|
||||
|
@@ -5,12 +5,12 @@ Getting Started
|
||||
Add TinyUSB to your project
|
||||
---------------------------
|
||||
|
||||
It is relatively simple to incorporate tinyusb to your project
|
||||
To incorporate tinyusb to your project
|
||||
|
||||
* Copy or ``git submodule`` this repo into your project in a subfolder. Let's say it is ``your_project/tinyusb``
|
||||
* Add all the ``.c`` in the ``tinyusb/src`` folder to your project
|
||||
* Add ``your_project/tinyusb/src`` to your include path. Also make sure your current include path also contains the configuration file ``tusb_config.h``.
|
||||
* Make sure all required macros are all defined properly in ``tusb_config.h`` (configure file in demo application is sufficient, but you need to add a few more such as ``CFG_TUSB_MCU``, ``CFG_TUSB_OS`` since they are passed by IDE/compiler to maintain a unique configure for all boards).
|
||||
* Make sure all required macros are all defined properly in ``tusb_config.h`` (configure file in demo application is sufficient, but you need to add a few more such as ``CFG_TUSB_MCU``, ``CFG_TUSB_OS`` since they are passed by make/cmake to maintain a unique configure for all boards).
|
||||
* If you use the device stack, make sure you have created/modified usb descriptors for your own need. Ultimately you need to implement all **tud descriptor** callbacks for the stack to work.
|
||||
* Add ``tusb_init(rhport, role)`` call to your reset initialization code.
|
||||
* Call ``tusb_int_handler(rhport, in_isr)`` in your USB IRQ Handler
|
||||
@@ -75,24 +75,36 @@ The hardware code is located in ``hw/bsp`` folder, and is organized by family/bo
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd examples/device/cdc_msc
|
||||
$ make BOARD=raspberry_pi_pico get-deps
|
||||
$ make BOARD=feather_nrf52840_express get-deps
|
||||
|
||||
You only need to do this once per family. Check out `complete list of dependencies and their designated path here <dependencies.rst>`_
|
||||
|
||||
Build
|
||||
^^^^^
|
||||
Build Examples
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
To build example, first change directory to an example folder.
|
||||
Examples support make and cmake build system for most MCUs, however some MCU families such as espressif or rp2040 only support cmake. First change directory to an example folder.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd examples/device/cdc_msc
|
||||
|
||||
Then compile with ``make BOARD={board_name} all`` , for example
|
||||
Then compile with make or cmake
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make BOARD=raspberry_pi_pico all
|
||||
$ # make
|
||||
$ make BOARD=feather_nrf52840_express all
|
||||
|
||||
$ # cmake
|
||||
$ mkdir build && cd build
|
||||
$ cmake -DBOARD=raspberry_pi_pico ..
|
||||
$ make
|
||||
|
||||
To list all available targets with cmake
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cmake --build . --target help
|
||||
|
||||
Note: some examples especially those that uses Vendor class (e.g webUSB) may requires udev permission on Linux (and/or macOS) to access usb device. It depends on your OS distro, typically copy ``99-tinyusb.rules`` and reload your udev is good to go
|
||||
|
||||
@@ -104,20 +116,24 @@ Note: some examples especially those that uses Vendor class (e.g webUSB) may req
|
||||
RootHub Port Selection
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If a board has several ports, one port is chosen by default in the individual board.mk file. Use option ``PORT=x`` To choose another port. For example to select the HS port of a STM32F746Disco board, use:
|
||||
If a board has several ports, one port is chosen by default in the individual board.mk file. Use option ``RHPORT_DEVICE=x`` or ``RHPORT_HOST=x`` To choose another port. For example to select the HS port of a STM32F746Disco board, use:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make BOARD=stm32f746disco PORT=1 all
|
||||
$ make BOARD=stm32f746disco RHPORT_DEVICE=1 all
|
||||
|
||||
$ cmake -DBOARD=stm32f746disco -DRHPORT_DEVICE=1 ..
|
||||
|
||||
Port Speed
|
||||
~~~~~~~~~~
|
||||
|
||||
A MCU can support multiple operational speed. By default, the example build system will use the fastest supported on the board. Use option ``SPEED=full/high`` e.g To force F723 operate at full instead of default high speed
|
||||
A MCU can support multiple operational speed. By default, the example build system will use the fastest supported on the board. Use option ``RHPORT_DEVICE_SPEED=OPT_MODE_FULL/HIGH_SPEED/`` or ``RHPORT_HOST_SPEED=OPT_MODE_FULL/HIGH_SPEED/`` e.g To force F723 operate at full instead of default high speed
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make BOARD=stm32f746disco SPEED=full all
|
||||
$ make BOARD=stm32f746disco RHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED all
|
||||
|
||||
$ cmake -DBOARD=stm32f746disco -DRHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED ..
|
||||
|
||||
Size Analysis
|
||||
~~~~~~~~~~~~~
|
||||
@@ -137,6 +153,8 @@ To compile for debugging add ``DEBUG=1``\ , for example
|
||||
|
||||
$ make BOARD=feather_nrf52840_express DEBUG=1 all
|
||||
|
||||
$ cmake -DBOARD=feather_nrf52840_express -DCMAKE_BUILD_TYPE=Debug ..
|
||||
|
||||
Log
|
||||
~~~
|
||||
|
||||
@@ -146,6 +164,8 @@ Should you have an issue running example and/or submitting an bug report. You co
|
||||
|
||||
$ make BOARD=feather_nrf52840_express LOG=2 all
|
||||
|
||||
$ cmake -DBOARD=feather_nrf52840_express -DLOG=2 ..
|
||||
|
||||
Logger
|
||||
~~~~~~
|
||||
|
||||
@@ -169,6 +189,9 @@ By default log message is printed via on-board UART which is slow and take lots
|
||||
$ make BOARD=feather_nrf52840_express LOG=2 LOGGER=rtt all
|
||||
$ make BOARD=feather_nrf52840_express LOG=2 LOGGER=swo all
|
||||
|
||||
$ cmake -DBOARD=feather_nrf52840_express -DLOG=2 -DLOGGER=rtt ..
|
||||
$ cmake -DBOARD=feather_nrf52840_express -DLOG=2 -DLOGGER=swo ..
|
||||
|
||||
Flash
|
||||
^^^^^
|
||||
|
||||
@@ -179,11 +202,15 @@ Flash
|
||||
$ make BOARD=feather_nrf52840_express flash
|
||||
$ make SERIAL=/dev/ttyACM0 BOARD=feather_nrf52840_express flash
|
||||
|
||||
Since jlink can be used with most of the boards, there is also ``flash-jlink`` target for your convenience.
|
||||
Since jlink/openocd can be used with most of the boards, there is also ``flash-jlink/openocd`` (make) and ``EXAMPLE-jlink/openocd`` target for your convenience. Note for stm32 board with stlink, you can use ``flash-stlink`` target as well.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make BOARD=feather_nrf52840_express flash-jlink
|
||||
$ make BOARD=feather_nrf52840_express flash-openocd
|
||||
|
||||
$ cmake --build . --target cdc_msc-jlink
|
||||
$ cmake --build . --target cdc_msc-openocd
|
||||
|
||||
Some board use uf2 bootloader for drag & drop in to mass storage device, uf2 can be generated with ``uf2`` target
|
||||
|
||||
@@ -191,17 +218,18 @@ Some board use uf2 bootloader for drag & drop in to mass storage device, uf2 can
|
||||
|
||||
$ make BOARD=feather_nrf52840_express all uf2
|
||||
|
||||
$ cmake --build . --target cdc_msc-uf2
|
||||
|
||||
IAR Support
|
||||
-----------
|
||||
^^^^^^^^^^^
|
||||
|
||||
Use project connection
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
IAR Project Connection files are provided to import TinyUSB stack into your project.
|
||||
|
||||
* A buildable project of your MCU need to be created in advance.
|
||||
|
||||
|
||||
* Take example of STM32F0:
|
||||
|
||||
- You need ``stm32l0xx.h``, ``startup_stm32f0xx.s``, ``system_stm32f0xx.c``.
|
||||
@@ -212,15 +240,13 @@ IAR Project Connection files are provided to import TinyUSB stack into your proj
|
||||
Click ``New Group ...``, name it to ``TUSB``, Click ``Add Variable ...``, name it to ``TUSB_DIR``, change it's value to the path of your TinyUSB stack,
|
||||
for example ``C:\\tinyusb``
|
||||
|
||||
Import stack only
|
||||
~~~~~~~~~~~~~~~~~
|
||||
**Import stack only**
|
||||
|
||||
1. Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\tools\\iar_template.ipcf``.
|
||||
Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\tools\\iar_template.ipcf``.
|
||||
|
||||
Run examples
|
||||
~~~~~~~~~~~~
|
||||
**Run examples**
|
||||
|
||||
1. (Python3 is needed) Run ``iar_gen.py`` to generate .ipcf files of examples:
|
||||
1. Run ``iar_gen.py`` to generate .ipcf files of examples:
|
||||
|
||||
.. code-block::
|
||||
|
||||
@@ -230,8 +256,8 @@ Run examples
|
||||
2. Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\examples\\(.ipcf of example)``.
|
||||
For example ``C:\\tinyusb\\examples\\device\\cdc_msc\\iar_cdc_msc.ipcf``
|
||||
|
||||
Native CMake support (9.50.1+)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Native CMake support
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
With 9.50.1 release, IAR added experimental native CMake support (strangely not mentioned in public release note). Now it's possible to import CMakeLists.txt then build and debug as a normal project.
|
||||
|
||||
|
@@ -123,27 +123,24 @@ endif
|
||||
ifeq (${MAX3421_HOST},1)
|
||||
SRC_C += src/portable/analog/max3421/hcd_max3421.c
|
||||
CFLAGS += -DCFG_TUH_MAX3421=1
|
||||
CMAKE_DEFSYM += -DMAX3421_HOST=1
|
||||
endif
|
||||
|
||||
# Log level is mapped to TUSB DEBUG option
|
||||
ifneq ($(LOG),)
|
||||
CMAKE_DEFSYM += -DLOG=$(LOG)
|
||||
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
|
||||
endif
|
||||
|
||||
# Logger: default is uart, can be set to rtt or swo
|
||||
ifneq ($(LOGGER),)
|
||||
CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
|
||||
endif
|
||||
|
||||
ifeq ($(LOGGER),rtt)
|
||||
CFLAGS += -DLOGGER_RTT -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
RTT_SRC = lib/SEGGER_RTT
|
||||
INC += $(TOP)/$(RTT_SRC)/RTT
|
||||
SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT.c
|
||||
else ifeq ($(LOGGER),swo)
|
||||
CFLAGS += -DLOGGER_RTT
|
||||
#CFLAGS += -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
INC += $(TOP)/$(lib/SEGGER_RTT)/RTT
|
||||
SRC_C += $(lib/SEGGER_RTT)/RTT/SEGGER_RTT.c
|
||||
endif
|
||||
ifeq ($(LOGGER),swo)
|
||||
CFLAGS += -DLOGGER_SWO
|
||||
else
|
||||
CFLAGS += -DLOGGER_UART
|
||||
endif
|
||||
|
||||
# CPU specific flags
|
||||
|
@@ -39,7 +39,7 @@
|
||||
#include "bsp/board_api.h"
|
||||
#include "tusb.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
// ESP-IDF need "freertos/" prefix in include path.
|
||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@@ -158,17 +158,16 @@ int main(void)
|
||||
xTaskCreate(audio_task, "audio", AUDIO_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL);
|
||||
#endif
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// only start scheduler for non-espressif mcu
|
||||
#ifndef ESP_PLATFORM
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
void app_main(void)
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
#endif
|
||||
|
@@ -59,7 +59,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -38,7 +38,7 @@
|
||||
#include "bsp/board_api.h"
|
||||
#include "tusb.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
// ESP-IDF need "freertos/" prefix in include path.
|
||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@@ -132,15 +132,15 @@ int main(void)
|
||||
xTaskCreate(usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL);
|
||||
#endif
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// only start scheduler for non-espressif mcu
|
||||
#ifndef ESP_PLATFORM
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -49,25 +49,34 @@ int main(void) {
|
||||
while (1) {
|
||||
uint32_t interval_ms = board_button_read() ? BLINK_PRESSED : BLINK_UNPRESSED;
|
||||
|
||||
int ch = board_getchar();
|
||||
if (ch > 0) {
|
||||
board_putchar(ch);
|
||||
#ifndef LOGGER_UART
|
||||
board_uart_write(&ch, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Blink and print every interval ms
|
||||
if (!(board_millis() - start_ms < interval_ms)) {
|
||||
board_uart_write(HELLO_STR, strlen(HELLO_STR));
|
||||
|
||||
start_ms = board_millis();
|
||||
|
||||
if (ch < 0) {
|
||||
// skip if echoing
|
||||
printf(HELLO_STR);
|
||||
|
||||
#ifndef LOGGER_UART
|
||||
board_uart_write(HELLO_STR, strlen(HELLO_STR));
|
||||
#endif
|
||||
}
|
||||
|
||||
board_led_write(led_state);
|
||||
led_state = 1 - led_state; // toggle
|
||||
}
|
||||
|
||||
// echo
|
||||
uint8_t ch;
|
||||
if (board_uart_read(&ch, 1) > 0) {
|
||||
board_uart_write(&ch, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include "bsp/board_api.h"
|
||||
#include "tusb.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define USBD_STACK_SIZE 4096
|
||||
#else
|
||||
// Increase stack size when debug log is enabled
|
||||
@@ -91,15 +91,15 @@ int main(void) {
|
||||
xTaskCreate(cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES - 2, NULL);
|
||||
#endif
|
||||
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#ifndef ESP_PLATFORM
|
||||
// only start scheduler for non-espressif mcu
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#include "tusb.h"
|
||||
#include "usb_descriptors.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
// ESP-IDF need "freertos/" prefix in include path.
|
||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@@ -112,17 +112,16 @@ int main(void)
|
||||
|
||||
xTimerStart(blinky_tm, 0);
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// only start scheduler for non-espressif mcu
|
||||
#ifndef ESP_PLATFORM
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
void app_main(void)
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
#endif
|
||||
|
@@ -59,7 +59,7 @@
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF PROTYPES
|
||||
//--------------------------------------------------------------------+
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define USBD_STACK_SIZE 4096
|
||||
#else
|
||||
// Increase stack size when debug log is enabled
|
||||
@@ -95,15 +95,15 @@ int main(void) {
|
||||
xTaskCreate(midi_task, "midi", MIDI_STACK_SIZE, NULL, configMAX_PRIORITIES - 2, NULL);
|
||||
#endif
|
||||
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#ifndef ESP_PLATFORM
|
||||
// only start scheduler for non-espressif mcu
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += lib/lwip
|
||||
|
||||
include ../../build_system/make/make.mk
|
||||
|
||||
# suppress warning caused by lwip
|
||||
|
@@ -292,7 +292,7 @@ void led_blinking_task(void* param) {
|
||||
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define VIDEO_STACK_SIZE (configMINIMAL_STACK_SIZE*4)
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define USBD_STACK_SIZE 4096
|
||||
int main(void);
|
||||
void app_main(void) {
|
||||
@@ -351,8 +351,8 @@ void freertos_init_task(void) {
|
||||
xTaskCreate(video_task, "video", VIDEO_STACK_SZIE, NULL, configMAX_PRIORITIES - 2, NULL);
|
||||
#endif
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// only start scheduler for non-espressif mcu
|
||||
#ifndef ESP_PLATFORM
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -300,7 +300,7 @@ void led_blinking_task(void* param) {
|
||||
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define VIDEO_STACK_SIZE (configMINIMAL_STACK_SIZE*4)
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define USBD_STACK_SIZE 4096
|
||||
int main(void);
|
||||
void app_main(void) {
|
||||
@@ -359,8 +359,8 @@ void freertos_init_task(void) {
|
||||
xTaskCreate(video_task, "video", VIDEO_STACK_SZIE, NULL, configMAX_PRIORITIES - 2, NULL);
|
||||
#endif
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// only start scheduler for non-espressif mcu
|
||||
#ifndef ESP_PLATFORM
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -72,7 +72,10 @@ void tuh_cdc_rx_cb(uint8_t idx) {
|
||||
if (count) {
|
||||
buf[count] = 0;
|
||||
printf("%s", (char*) buf);
|
||||
fflush(stdout);
|
||||
|
||||
#ifndef __ICCARM__ // TODO IAR doesn't support stream control ?
|
||||
fflush(stdout);// flush right away, else nanolib will wait for newline
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include "tusb.h"
|
||||
#include "bsp/board_api.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CDC_STACK_SZIE 2048
|
||||
#else
|
||||
#define CDC_STACK_SZIE (3*configMINIMAL_STACK_SIZE/2)
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include "bsp/board_api.h"
|
||||
#include "tusb.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define USBH_STACK_SIZE 4096
|
||||
#else
|
||||
// Increase stack size when debug log is enabled
|
||||
@@ -86,15 +86,15 @@ int main(void) {
|
||||
|
||||
xTimerStart(blinky_tm, 0);
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// only start scheduler for non-espressif mcu
|
||||
#ifndef ESP_PLATFORM
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -268,7 +268,7 @@ void led_blinking_task(void* param) {
|
||||
|
||||
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define USB_STACK_SIZE 4096
|
||||
#else
|
||||
// Increase stack size when debug log is enabled
|
||||
@@ -285,7 +285,7 @@ StackType_t usb_stack[USB_STACK_SIZE];
|
||||
StaticTask_t usb_taskdef;
|
||||
#endif
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
@@ -308,8 +308,8 @@ void init_freertos_task(void) {
|
||||
xTaskCreate(usb_host_task, "usbh", USB_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL);
|
||||
#endif
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// only start scheduler for non-espressif mcu
|
||||
#ifndef ESP_PLATFORM
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -40,7 +40,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
|
@@ -71,9 +71,8 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
void app_main(void)
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
void app_main(void) {
|
||||
main();
|
||||
}
|
||||
#endif
|
||||
|
@@ -60,13 +60,11 @@ int sys_read(int fhdl, char *buf, size_t count) {
|
||||
int rd = (int) SEGGER_RTT_Read(0, buf, count);
|
||||
return (rd > 0) ? rd : -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#elif defined(LOGGER_SWO)
|
||||
|
||||
#define ITM_BASE 0xE0000000
|
||||
|
||||
#define ITM_STIM0 (*((volatile uint8_t*)(ITM_BASE + 0)))
|
||||
#define ITM_TER *((volatile uint32_t*)(ITM_BASE + 0xE00))
|
||||
#define ITM_TCR *((volatile uint32_t*)(ITM_BASE + 0xE80))
|
||||
@@ -150,6 +148,9 @@ int board_getchar(void) {
|
||||
return (sys_read(0, &c, 1) > 0) ? (int) c : (-1);
|
||||
}
|
||||
|
||||
void board_putchar(int c) {
|
||||
sys_write(0, (const char*)&c, 1);
|
||||
}
|
||||
|
||||
uint32_t tusb_time_millis_api(void) {
|
||||
return board_millis();
|
||||
@@ -158,7 +159,7 @@ uint32_t tusb_time_millis_api(void) {
|
||||
//--------------------------------------------------------------------
|
||||
// FreeRTOS hooks
|
||||
//--------------------------------------------------------------------
|
||||
#if CFG_TUSB_OS == OPT_OS_FREERTOS && !TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#if CFG_TUSB_OS == OPT_OS_FREERTOS && !defined(ESP_PLATFORM)
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
@@ -240,5 +241,4 @@ void vApplicationSetupTimerInterrupt(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -41,7 +41,7 @@ extern "C" {
|
||||
#if CFG_TUSB_OS == OPT_OS_ZEPHYR
|
||||
#include <zephyr/kernel.h>
|
||||
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#ifdef ESP_PLATFORM
|
||||
// ESP-IDF need "freertos/" prefix in include path.
|
||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@@ -195,6 +195,7 @@ static inline void board_delay(uint32_t ms) {
|
||||
|
||||
// stdio getchar() is blocking, this is non-blocking version
|
||||
int board_getchar(void);
|
||||
void board_putchar(int c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -13,7 +13,6 @@ else
|
||||
# The submodule BRTSG-FOSS/ft90x-sdk contains header files and source
|
||||
# code for the Bridgetek SDK. This can be used instead of the prebuilt
|
||||
# library.
|
||||
DEPS_SUBMODULES += hw/mcu/bridgetek/ft9xx/ft90x-sdk
|
||||
# The SDK can be used to load specific files from the Bridgetek SDK.
|
||||
FT9XX_SDK = hw/mcu/bridgetek/ft9xx/ft90x-sdk/Source
|
||||
INC += "$(TOP)/$(FT9XX_SDK)/include"
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# Submodules
|
||||
CH32F20X_SDK = hw/mcu/wch/ch32f20x
|
||||
DEPS_SUBMODULES += $(CH32F20X_SDK)
|
||||
|
||||
# WCH-SDK paths
|
||||
CH32F20X_SDK_SRC = $(CH32F20X_SDK)/EVT/EXAM/SRC
|
||||
|
@@ -156,6 +156,10 @@ int board_getchar(void) {
|
||||
return getchar();
|
||||
}
|
||||
|
||||
void board_putchar(int c) {
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// PHY Init
|
||||
//--------------------------------------------------------------------
|
||||
|
@@ -1,5 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# Apply board specific content i.e IDF_TARGET must be set before project.cmake is included
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake")
|
||||
string(TOUPPER ${IDF_TARGET} FAMILY_MCUS)
|
||||
|
@@ -1,34 +0,0 @@
|
||||
#DEPS_SUBMODULES +=
|
||||
|
||||
UF2_FAMILY_ID_esp32s2 = 0xbfdd4eee
|
||||
UF2_FAMILY_ID_esp32s3 = 0xc47e5767
|
||||
|
||||
BOARD_CMAKE := $(file < $(TOP)/$(BOARD_PATH)/board.cmake)
|
||||
ifneq ($(findstring esp32s2,$(BOARD_CMAKE)),)
|
||||
IDF_TARGET = esp32s2
|
||||
else
|
||||
ifneq ($(findstring esp32s3,$(BOARD_CMAKE)),)
|
||||
IDF_TARGET = esp32s3
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: all clean flash bootloader-flash app-flash erase monitor dfu-flash dfu
|
||||
|
||||
all:
|
||||
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) build
|
||||
|
||||
build: all
|
||||
|
||||
fullclean:
|
||||
if test -f sdkconfig; then $(RM) -f sdkconfig ; fi
|
||||
if test -d $(BUILD); then $(RM) -rf $(BUILD) ; fi
|
||||
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) $@
|
||||
|
||||
clean flash bootloader-flash app-flash erase monitor dfu-flash dfu size size-components size-files:
|
||||
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) $@
|
||||
|
||||
uf2: $(BUILD)/$(PROJECT).uf2
|
||||
|
||||
$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).bin
|
||||
@echo CREATE $@
|
||||
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID_$(IDF_TARGET)) -b 0x0 -c -o $@ $^
|
@@ -221,6 +221,8 @@ function(family_configure_common TARGET RTOS)
|
||||
target_include_directories(${TARGET} PUBLIC ${TOP}/lib/SEGGER_RTT/RTT)
|
||||
# target_compile_definitions(${TARGET} PUBLIC SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL)
|
||||
endif ()
|
||||
else ()
|
||||
target_compile_definitions(${TARGET} PUBLIC LOGGER_UART)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
|
@@ -1,6 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x4fb2d5bd
|
||||
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
||||
DEPS_SUBMODULES += $(SDK_DIR) lib/CMSIS_5
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
||||
DEPS_SUBMODULES += $(SDK_DIR) lib/CMSIS_5
|
||||
|
||||
MCU_DIR = $(SDK_DIR)/devices/${MCU_VARIANT}
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
@@ -1,5 +1,4 @@
|
||||
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
||||
DEPS_SUBMODULES += $(SDK_DIR) lib/CMSIS_5
|
||||
|
||||
MCU_DIR = $(SDK_DIR)/devices/$(MCU)
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nxp/lpcopen
|
||||
|
||||
CFLAGS += \
|
||||
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))'
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nxp/lpcopen
|
||||
|
||||
MCU_DIR = hw/mcu/nxp/lpcopen/lpc13xx/lpc_chip_13xx
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
CPU_CORE ?= cortex-m3
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nxp/lpcopen
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
CPU_CORE ?= cortex-m3
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nxp/lpcopen
|
||||
|
||||
MCU_DIR = hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
CPU_CORE ?= cortex-m3
|
||||
|
@@ -1,4 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nxp/lpcopen
|
||||
MCU_DIR = hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nxp/lpcopen
|
||||
|
||||
MCU_DIR = hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
CPU_CORE ?= cortex-m4
|
||||
|
@@ -1,4 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nxp/lpcopen
|
||||
SDK_DIR = hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx
|
||||
|
||||
include ${TOP}/${BOARD_PATH}/board.mk
|
||||
|
@@ -1,5 +1,4 @@
|
||||
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
||||
DEPS_SUBMODULES += $(SDK_DIR) lib/CMSIS_5
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
CPU_CORE ?= cortex-m4
|
||||
|
@@ -1,6 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x2abc77ec
|
||||
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
||||
DEPS_SUBMODULES += lib/CMSIS_5 lib/sct_neopixel $(SDK_DIR)
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
CPU_CORE ?= cortex-m33
|
||||
|
@@ -1,8 +1,6 @@
|
||||
UF2_FAMILY_ID = 0x2abc77ec
|
||||
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
||||
|
||||
DEPS_SUBMODULES += $(SDK_DIR) lib/CMSIS_5
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
# Default to Highspeed PORT1
|
||||
|
@@ -11,36 +11,37 @@ set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/msp430_${T
|
||||
|
||||
set(FAMILY_MCUS MSP430x5xx CACHE INTERNAL "")
|
||||
|
||||
|
||||
#------------------------------------
|
||||
# BOARD_TARGET
|
||||
#------------------------------------
|
||||
# only need to be built ONCE for all examples
|
||||
function(add_board_target BOARD_TARGET)
|
||||
if (NOT TARGET ${BOARD_TARGET})
|
||||
add_library(${BOARD_TARGET} INTERFACE)
|
||||
target_compile_definitions(${BOARD_TARGET} INTERFACE
|
||||
CFG_TUD_ENDPOINT0_SIZE=8
|
||||
CFG_EXAMPLE_VIDEO_READONLY
|
||||
CFG_EXAMPLE_MSC_READONLY
|
||||
)
|
||||
target_include_directories(${BOARD_TARGET} INTERFACE
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${SDK_DIR}
|
||||
)
|
||||
if (TARGET ${BOARD_TARGET})
|
||||
return()
|
||||
endif ()
|
||||
|
||||
update_board(${BOARD_TARGET})
|
||||
add_library(${BOARD_TARGET} INTERFACE)
|
||||
target_compile_definitions(${BOARD_TARGET} INTERFACE
|
||||
CFG_TUD_ENDPOINT0_SIZE=8
|
||||
CFG_EXAMPLE_VIDEO_READONLY
|
||||
CFG_EXAMPLE_MSC_READONLY
|
||||
)
|
||||
target_include_directories(${BOARD_TARGET} INTERFACE
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${SDK_DIR}
|
||||
)
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(${BOARD_TARGET} INTERFACE
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
-L${SDK_DIR}
|
||||
)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||
target_link_options(${BOARD_TARGET} INTERFACE
|
||||
"LINKER:--config=${LD_FILE_IAR}"
|
||||
)
|
||||
endif ()
|
||||
update_board(${BOARD_TARGET})
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(${BOARD_TARGET} INTERFACE
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
-L${SDK_DIR}
|
||||
)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||
target_link_options(${BOARD_TARGET} INTERFACE
|
||||
"LINKER:--config=${LD_FILE_IAR}"
|
||||
)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
@@ -75,7 +76,6 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
family_flash_msp430flasher(${TARGET})
|
||||
|
@@ -1,5 +1,4 @@
|
||||
CROSS_COMPILE = msp430-elf-
|
||||
DEPS_SUBMODULES += hw/mcu/ti
|
||||
SKIP_NANOLIB = 1
|
||||
|
||||
SDK_DIR = hw/mcu/ti/msp430/msp430-gcc-support-files/include
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nuvoton
|
||||
|
||||
CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nuvoton
|
||||
|
||||
CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nuvoton
|
||||
|
||||
CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nuvoton
|
||||
|
||||
CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/nuvoton
|
||||
|
||||
CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
|
@@ -254,7 +254,7 @@ size_t board_get_unique_id(uint8_t id[], size_t max_len) {
|
||||
int board_uart_read(uint8_t *buf, int len) {
|
||||
#ifdef UART_DEV
|
||||
int count = 0;
|
||||
while ( (count < len) && uart_is_readable(uart_inst) ) {
|
||||
while ((count < len) && uart_is_readable(uart_inst)) {
|
||||
buf[count] = uart_getc(uart_inst);
|
||||
count++;
|
||||
}
|
||||
@@ -282,6 +282,10 @@ int board_getchar(void) {
|
||||
return getchar_timeout_us(0);
|
||||
}
|
||||
|
||||
void board_putchar(int c) {
|
||||
stdio_putchar(c);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB Interrupt Handler
|
||||
// rp2040 implementation will install appropriate handler when initializing
|
||||
|
@@ -1,18 +0,0 @@
|
||||
JLINK_DEVICE = rp2040_m0_0
|
||||
PYOCD_TARGET = rp2040
|
||||
|
||||
DEPS_SUBMODULES += hw/mcu/raspberry_pi/Pico-PIO-USB
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CMAKE_DEFSYM += -DCMAKE_BUILD_TYPE=Debug
|
||||
endif
|
||||
|
||||
$(BUILD):
|
||||
cmake -S . -B $(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) -DPICO_BUILD_DOCS=0 $(CMAKE_DEFSYM)
|
||||
|
||||
all: $(BUILD)
|
||||
$(MAKE) -C $(BUILD)
|
||||
|
||||
flash: flash-pyocd
|
||||
flash-uf2:
|
||||
@$(CP) $(BUILD)/$(PROJECT).uf2 /media/$(USER)/RPI-RP2
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/renesas/rx
|
||||
|
||||
# Cross Compiler for RX
|
||||
CROSS_COMPILE = rx-elf-
|
||||
|
||||
|
@@ -1,4 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/microchip
|
||||
ASF_DIR = hw/mcu/microchip/same70
|
||||
|
||||
CFLAGS += \
|
||||
|
@@ -1,4 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/microchip
|
||||
ASF_DIR = hw/mcu/microchip/same70
|
||||
|
||||
CFLAGS += \
|
||||
|
@@ -16,9 +16,6 @@ CFLAGS += \
|
||||
SILABS_FAMILY = efm32gg12b
|
||||
SILABS_CMSIS = hw/mcu/silabs/cmsis-dfp-$(SILABS_FAMILY)/Device/SiliconLabs/$(shell echo $(SILABS_FAMILY) | tr a-z A-Z)
|
||||
|
||||
DEPS_SUBMODULES += hw/mcu/silabs/cmsis-dfp-$(SILABS_FAMILY)
|
||||
DEPS_SUBMODULES += lib/CMSIS_5
|
||||
|
||||
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += hw/mcu/sony/cxd56/spresense-exported-sdk
|
||||
|
||||
# Platforms are: Linux, Darwin, MSYS, CYGWIN
|
||||
PLATFORM := $(firstword $(subst _, ,$(shell uname -s 2>/dev/null)))
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
ST_FAMILY = c0
|
||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_$(ST_FAMILY) hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x647824b6
|
||||
ST_FAMILY = f0
|
||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_$(ST_FAMILY) hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
ST_FAMILY = f1
|
||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_${ST_FAMILY} hw/mcu/st/stm32${ST_FAMILY}xx_hal_driver
|
||||
|
||||
ST_CMSIS = hw/mcu/st/cmsis_device_${ST_FAMILY}
|
||||
ST_HAL_DRIVER = hw/mcu/st/stm32${ST_FAMILY}xx_hal_driver
|
||||
|
||||
|
@@ -2,11 +2,6 @@ ST_FAMILY = f2
|
||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
DEPS_SUBMODULES += \
|
||||
lib/CMSIS_5 \
|
||||
$(ST_CMSIS) \
|
||||
$(ST_HAL_DRIVER)
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
CPU_CORE ?= cortex-m3
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x53b80f00
|
||||
ST_FAMILY = f7
|
||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_$(ST_FAMILY) hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
@@ -1,5 +1,4 @@
|
||||
ST_FAMILY = g0
|
||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_$(ST_FAMILY) hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
@@ -1,5 +1,4 @@
|
||||
ST_FAMILY = l4
|
||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_$(ST_FAMILY) hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
@@ -1,5 +1,4 @@
|
||||
ST_FAMILY = u5
|
||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_$(ST_FAMILY) hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
@@ -1,8 +1,6 @@
|
||||
UF2_FAMILY_ID = 0x00
|
||||
SDK_DIR = hw/mcu/infineon/mtb-xmclib-cat3
|
||||
|
||||
DEPS_SUBMODULES += ${SDK_DIR}
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
CPU_CORE ?= cortex-m4
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
DEPS_SUBMODULES += lib/lwip
|
||||
|
||||
include ../../make.mk
|
||||
|
||||
# suppress warning caused by lwip
|
||||
|
@@ -124,11 +124,5 @@ endif
|
||||
|
||||
# Log level is mapped to TUSB DEBUG option
|
||||
ifneq ($(LOG),)
|
||||
CMAKE_DEFSYM += -DLOG=$(LOG)
|
||||
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
|
||||
endif
|
||||
|
||||
# Logger: default is uart, can be set to rtt or swo
|
||||
ifneq ($(LOGGER),)
|
||||
CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
|
||||
endif
|
||||
|
@@ -142,7 +142,7 @@ endif
|
||||
# get depenecies
|
||||
.PHONY: get-deps
|
||||
get-deps:
|
||||
$(PYTHON) $(TOP)/tools/get_deps.py $(DEPS_SUBMODULES)
|
||||
$(PYTHON) $(TOP)/tools/get_deps.py $(FAMILY)
|
||||
|
||||
size: $(BUILD)/$(PROJECT)
|
||||
-@echo ''
|
||||
|
@@ -101,10 +101,8 @@ def cmake_board(board, toolchain, build_flags_on):
|
||||
if build_utils.skip_example(example, board):
|
||||
ret[2] += 1
|
||||
else:
|
||||
rcmd = run_cmd(f'cmake examples/{example} -B {build_dir}/{example} -G Ninja '
|
||||
f'-DBOARD={board} {build_flags}')
|
||||
if rcmd.returncode == 0:
|
||||
rcmd = run_cmd(f'cmake --build {build_dir}/{example}')
|
||||
rcmd = run_cmd(f'idf.py -C examples/{example} -B {build_dir}/{example} -G Ninja '
|
||||
f'-DBOARD={board} {build_flags} build')
|
||||
ret[0 if rcmd.returncode == 0 else 1] += 1
|
||||
else:
|
||||
rcmd = run_cmd(f'cmake examples -B {build_dir} -G Ninja -DBOARD={board} -DCMAKE_BUILD_TYPE=MinSizeRel '
|
||||
@@ -156,16 +154,21 @@ def make_one_example(example, board, make_option):
|
||||
|
||||
def make_board(board, toolchain):
|
||||
print(build_separator)
|
||||
all_examples = get_examples(find_family(board))
|
||||
family = find_family(board);
|
||||
all_examples = get_examples(family)
|
||||
start_time = time.monotonic()
|
||||
ret = [0, 0, 0]
|
||||
with Pool(processes=os.cpu_count()) as pool:
|
||||
pool_args = list((map(lambda e, b=board, o=f"TOOLCHAIN={toolchain}": [e, b, o], all_examples)))
|
||||
r = pool.starmap(make_one_example, pool_args)
|
||||
# sum all element of same index (column sum)
|
||||
ret = list(map(sum, list(zip(*r))))
|
||||
example = 'all'
|
||||
print_build_result(board, example, 0 if ret[1] == 0 else 1, time.monotonic() - start_time)
|
||||
if family == 'espressif' or family == 'rp2040':
|
||||
# espressif and rp2040 do not support make, use cmake instead
|
||||
final_status = 2
|
||||
else:
|
||||
with Pool(processes=os.cpu_count()) as pool:
|
||||
pool_args = list((map(lambda e, b=board, o=f"TOOLCHAIN={toolchain}": [e, b, o], all_examples)))
|
||||
r = pool.starmap(make_one_example, pool_args)
|
||||
# sum all element of same index (column sum)
|
||||
ret = list(map(sum, list(zip(*r))))
|
||||
final_status = 0 if ret[1] == 0 else 1
|
||||
print_build_result(board, 'all', final_status, time.monotonic() - start_time)
|
||||
return ret
|
||||
|
||||
|
||||
|
@@ -26,6 +26,8 @@ def skip_example(example, board):
|
||||
|
||||
# family.mk
|
||||
family_mk = family_dir / "family.mk"
|
||||
if not family_mk.exists():
|
||||
family_mk = family_dir / "family.cmake"
|
||||
mk_contents = family_mk.read_text()
|
||||
|
||||
# Find the mcu, first in family mk then board mk
|
||||
|
Reference in New Issue
Block a user