File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9898 tests : " boot gpio i2c spi crypto uart"
9999 - device : stm32g474ret6
100100 max_size : 393216
101+ # 384 KB flash: exclude mbedTLS/crypto (~38 KB) to fit the whole
102+ # firmware. G474 has an RNG, so crypto is opt-out via the flag.
103+ disable-crypto : " ON"
101104 - device : stm32l476rgt6
102105 max_size : 524288
103106 - device : stm32l562qei6
@@ -166,7 +169,7 @@ jobs:
166169 set -euo pipefail
167170 mkdir build
168171 cd build
169- cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/arm-toolchain.cmake -DDEVICE=${{ matrix.device }} ${{ matrix.usb-cdc == 'ON' && '-DAVM_USB_CDC_PORT_DRIVER_ENABLED=ON' || '' }}
172+ cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/arm-toolchain.cmake -DDEVICE=${{ matrix.device }} ${{ matrix.usb-cdc == 'ON' && '-DAVM_USB_CDC_PORT_DRIVER_ENABLED=ON' || '' }} ${{ matrix.disable-crypto == 'ON' && '-DAVM_DISABLE_MBEDTLS=ON' || '' }}
170173 cmake --build .
171174
172175 - name : " Perform CodeQL Analysis"
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ option(AVM_ENABLE_LOG_LINES "Include source and line info for all enabled levels
3535option (AVM_CONFIG_REBOOT_ON_NOT_OK "Reboot when application exits with non 'ok' return" OFF )
3636option (AVM_DISABLE_GPIO_NIFS "Disable GPIO nifs (input and output)" OFF )
3737option (AVM_DISABLE_GPIO_PORT_DRIVER "Disable GPIO 'port' driver (input, output, and interrupts)" OFF )
38+ option (AVM_DISABLE_MBEDTLS "Exclude mbedTLS/crypto NIFs even on devices with an RNG (saves ~38 KB flash)" OFF )
3839option (AVM_PRINT_PROCESS_CRASH_DUMPS "Print crash reports when processes die with non-standard reasons" ON )
3940
4041set (AVM_HSE_VALUE "" CACHE STRING "HSE crystal frequency in Hz (e.g. 25000000). Overrides family default." )
Original file line number Diff line number Diff line change @@ -155,10 +155,22 @@ else()
155155 set (STM32_HAS_RNG FALSE )
156156endif ()
157157
158+ # Flash-constrained devices that do have an RNG (e.g. stm32g474ret6, 384 KB
159+ # flash) can opt out of mbedTLS/crypto to save ~38 KB. STM32_HAS_RNG is the
160+ # sole gate for crypto (mbedTLS fetch/link + otp_crypto.c), so forcing it FALSE
161+ # takes the same no-crypto path already exercised by RNG-less devices (g0b1).
162+ if (STM32_HAS_RNG AND AVM_DISABLE_MBEDTLS)
163+ set (STM32_HAS_RNG FALSE )
164+ set (STM32_CRYPTO_DISABLED_BY_OPTION TRUE )
165+ endif ()
166+
158167message ("-----------Device Info-----------" )
159168message (STATUS "Device : ${DEVICE} " )
160169message (STATUS "Family : ${STM32_FAMILY} " )
161170message (STATUS "CPU : ${STM32_CPU} " )
162171message (STATUS "FPU : ${STM32_FPU} " )
163172message (STATUS "Arch Flags : ${_arch_flags_str} " )
164173message (STATUS "Has RNG : ${STM32_HAS_RNG} " )
174+ if (STM32_CRYPTO_DISABLED_BY_OPTION)
175+ message (STATUS "Crypto : disabled via AVM_DISABLE_MBEDTLS (RNG present)" )
176+ endif ()
You can’t perform that action at this time.
0 commit comments