Simultaneous regular mode with two ADCs (F303)

What are you developing?
ag123
Posts: 1881
Joined: Thu Dec 19, 2019 5:30 am
Answers: 30

Re: Simultaneous regular mode with two ADCs (F303)

Post by ag123 »

I'm not too sure if this may help
https://github.com/stm32duino/ArduinoModule-CMSIS
but otherwise
https://github.com/ARM-software/CMSIS_5/
:)

btw if you use CMake
https://github.com/stm32duino/Arduino_C ... esentation
https://github.com/stm32duino/Arduino_C ... wiki/Setup
https://github.com/stm32duino/Arduino_C ... tart-guide

and you did just this
viewtopic.php?t=2563

reposted:
after prerequisites are installed, is to run the quick start script from the *parent* (above sketch) folder of the sketch to generate a CMakeList.txt file in the sketch folder
https://github.com/stm32duino/Arduino_C ... art-script
e.g. where [ARDUINO_CORE_STM32_FOLDER] is where you git clone the Arduino_Core_STM32 repo

Code: Select all

python3 [ARDUINO_CORE_STM32_FOLDER]/cmake/scripts/cmake_easy_setup.py --board BLACKPILL_F401CC --sketch sketch_folder
edit the generated CMakeList.txt file in the sketch folder to see that all your sketch sources are listed under the build_sketch() section.

then the build steps are, make a directory e.g. build (this is for CMake to generate it's work scripts / files and build, the bin file is found there after the build)
https://github.com/stm32duino/Arduino_C ... sing-cmake

Code: Select all

cmake -S [source folder] -B [build folder] -G Ninja
^ when you run this step, the whole toolchain including xpack_arm_none_gcc, CMSIS 5 would be downloaded by this step.
In Linux it gets stored in $HOME/.Arduino_Core_STM32_dl, I'm not too sure about windows.

then to actually compile it is

Code: Select all

cmake --build [build folder]
I'm preferring CMake to Arduino IDE, it is quite easy to make custom variant folder locations. But It'd take learning CMake a little.
After you run the first step python script, it'd generate a CMakeList.txt like such

Code: Select all

# This file was autogenerated by:
# /[ core path ]/Arduino_Core_STM32/cmake/scripts/cmake_easy_setup.py
# Use it in your CMake configuration by `include()`'ing it.
# You can also copy it in your sketch's folder and edit it to fit your project.

cmake_minimum_required(VERSION 3.21)

# STEP 1: set up bases of environment
# -----------------------------------------------------------------------------

file(REAL_PATH "/[your actual core path]/Arduino_Core_STM32" CORE_PATH EXPAND_TILDE)
file(TO_CMAKE_PATH "${CORE_PATH}" CORE_PATH)

file(REAL_PATH "~/Arduino/libraries" USER_LIBS EXPAND_TILDE)
file(TO_CMAKE_PATH "${USER_LIBS}" USER_LIBS)

set(BOARDNAME "BLACKPILL_F303CC")

list(APPEND CMAKE_MODULE_PATH ${CORE_PATH}/cmake)
set(CMAKE_TOOLCHAIN_FILE toolchain)


# This block can be removed when using this file as the sketch's CMakeLists.txt
if (NOT ${CMAKE_PARENT_LIST_FILE} STREQUAL ${CMAKE_CURRENT_LIST_FILE})
    # When imported from the main CMakeLists.txt, it should stop here
    # not to interfere with the true build config.
    return()
endif()

project("test_project")

# STEP 2: configure the build
# -----------------------------------------------------------------------------

# Uncomment and pick the relevant value for each keyword!
# The first value listed is the default (when the feature is supported by the board)
# This means that leaving everything commented out yields the default config
include(set_board)
set_board("${BOARDNAME}"
  # SERIAL generic / disabled / none
  # USB none / CDCgen / CDC / HID
  # XUSB FS / HS / HSFS
  # VIRTIO disable / generic / enabled
  # BOOTLOADER dfuo / dfu2 / hid
)

include(overall_settings)
overall_settings(
  # STANDARD_LIBC
  # PRINTF_FLOAT
  # SCANF_FLOAT
  # DEBUG_SYMBOLS
  # LTO
  # NO_RELATIVE_MACRO
  # UNDEF_NDEBUG
  # OPTIMIZATION "s"
  # BUILD_OPT ./build.opt
  # DISABLE_HAL_MODULES ADC I2C RTC SPI TIM DAC EXTI ETH SD QSPI
  # CORE_CALLBACK
)

# STEP 3: configure your sketch
# -----------------------------------------------------------------------------
include(external_library)
# Cannot tell the dependencies of the library ahead-of-time
# Please write them in using the DEPENDS ... clause
# The same directives apply as for `build_sketch()` just below.

include(build_sketch)
build_sketch(TARGET "test"
  SOURCES
  ./file1.ino
  ./file2.ino
  ./file3.cpp
  ./file4.c
  ./file5.S

  # Uncomment the lines below to bind libraries to your sketch
  # Legitimate names after the DEPENDS keywords are:
  # - libraries declared with external_library
  # - libraries from the libraries/ folder of Arduino_Core_STM32

  # DEPENDS
  # SD
  # Wire
  # SPI
  # USBDevice
  # VirtIO
)

# STEP 4: optional features
# -----------------------------------------------------------------------------

include(insights)
insights(TARGET "test"
  # DIRECT_INCLUDES
  # TRANSITIVE_INCLUDES
  # SYMBOLS
  # ARCHIVES
  # LOGIC_STRUCTURE
}
that

Code: Select all

include(set_board)
set_board("${BOARDNAME}"

can be customized, the 'set_board' script, is shipped with the core in cmake directory
https://github.com/stm32duino/Arduino_C ... oard.cmake

what I did is to make a custom 'set_board', deriving some entries from the boards_db in a custom folder
https://github.com/stm32duino/Arduino_C ... s_db.cmake
and copying out the variant source files in the folder to a local folder.
I can actually work on the variant files in my own local variant source folder.

I think this may be very convenient for those who are trying to make a variant for a new board. Otherwise, the usual way with Arduino IDE is to edit boards.txt clone and edit the entries for your new board, and the variant sources need to be patched into the variant tree in the core.
Post Reply

Return to “Projects”