espressif_tinyusb/hw/mcu/st
hathach e909270843 rename bsp of stm32 board 2019-07-19 20:37:38 +07:00
..
cmsis st: Use submodules for system files when possible, use more up to date 2019-03-04 10:41:05 -05:00
startup adding stm32f3 support 2019-03-22 15:27:03 +07:00
stm32lib@1dabc2df8e change stm32lib submodule to our folk for now for flexibility 2019-05-15 16:58:08 +07:00
system-init adding stm32f3 support 2019-03-22 15:27:03 +07:00
README.md rename bsp of stm32 board 2019-07-19 20:37:38 +07:00

README.md

This README describes the layout of system files and headers for microcontrollers supported by tinyusb from the vendor ST.

The CMSIS by ARM is an attempt to unify how system initialization and headers for ARM microcontrollers are handled across vendors. A vendor is expected to provide a number of files, including vendor-specific device headers, vendor-specific system init code (in C), vendor-specific startup code (coded in assembly and meant to make writing C interrupt handlers easy), and ARM architecture-specific headers. In practice, it's actually difficult to find all these files in one place.

  • stm32cube generates a self-contained application. All the relevant headers, system init, and startup code are under Drivers/CMSIS. The linker script is stored at the root of your project, along with a copy of the startup code. Relative to Drivers/CMSIS:

    • Device header files are stored under Device/ST/$family/Include.
    • Arm-provided CMSIS headers are stored under Include.
    • The portable C portion of the startup code, called system_$family.c, is stored under Device/ST/$family/Source/Templates. This "system init" code is required by CMSIS.
    • The assembly portion of the startup code, called startup_$device.c, is stored under Device\ST\STM32F4xx\Source\Templates\gcc.
  • Micropython maintains a repo with only the device header files. We use that repo and provide the remaining files ourselves.

    • Micropython keeps the linker script and assembly portion of the startup code under the boards directory in the stm32 port (but the code is board agnostic).
    • Micropython also embeds its own copy of CMSIS headers for all ARM targets into the repo.
    • Micropython indeed does use their own custom C startup code (CMSIS system init) for stm32 targets. It is missing the SystemCoreClockUpdate function.
  • TinyUSB uses Micropython's stm32lib as a submodule to provide device headers. The remaining system files can be found in the following directories:

    • C system init code is in the system-init directory.
    • Assembly startup code is in the startup directory. Each family gets its own subdirectory under startup (e.g. stm32f4).
    • ARM-provided headers are stored in the cmsis directory.
    • The linker script for the STM32F4-DISCOVERY board demo is supplied as part of TinyUSB's Board Support Packages. The above files were extracted from a dummy stm32cube project in February