-
Notifications
You must be signed in to change notification settings - Fork 0
Adding NUCLEO_WL55JC support #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
tools/export/uvision/__init__.py
Outdated
@@ -171,7 +171,7 @@ def format_flags(self): | |||
'--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + | |||
",".join("-D{}".format(s) for s in | |||
self.toolchain.get_symbols(for_asm=True))) | |||
flags['asm_flags'] = asm_flag_string | |||
flags['asm_flags'] = "{} {}".format(" ".join(self.toolchain.flags['asm']), asm_flag_string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this patch from PR => followed by ARMmbed#10424
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tools/cmake/cores/Cortex-M4.cmake
Outdated
@@ -2,6 +2,7 @@ | |||
# SPDX-License-Identifier: Apache-2.0 | |||
|
|||
# Sets cpu core options | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove patch from this PR => ARMmbed#14185
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
targets/targets.json
Outdated
"device_has_remove": [ | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
"CRC", | ||
"FLASH", | ||
"SERIAL_ASYNCH", | ||
"ANALOGOUT", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miss ANALOGIN ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I am updating.
targets/TARGET_STM/trng_api.c
Outdated
@@ -37,7 +37,7 @@ void trng_init(trng_t *obj) | |||
{ | |||
uint32_t dummy; | |||
|
|||
#if defined(RCC_PERIPHCLK_RNG) /* STM32L4 / STM32H7 / STM32WB / STM32G4 */ | |||
#if defined(RCC_PERIPHCLK_RNG) /* STM32L4 / STM32H7 / STM32WB */ /* STM32WL*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep STM32G4 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
#include "stm32wlxx.h" | ||
#include "mbed_error.h" | ||
#include "stm32wlxx_ll_hsem.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed not used. Updated.
void Error_Handler(void) | ||
{ | ||
/* USER CODE BEGIN Error_Handler_Debug */ | ||
/* User can add his own implementation to report the HAL error return state */ | ||
while (1) | ||
{ | ||
} | ||
/* USER CODE END Error_Handler_Debug */ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/* Peripheral clock enable */ | ||
/* __HAL_RCC_RNG_CLK_ENABLE(); A DECOMMENTER PEUT-ETRE */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) | ||
{ | ||
Error_Handler(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use MBED_ASSERT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
* @retval None | ||
*/ | ||
|
||
void SetSysClock(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add MBED_WEAK to allow application to reconfigure clock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
#define __VTOR_PRESENT 1U /*!< Vector Table Register supported */ | ||
#define __NVIC_PRIO_BITS 4U /*!< STM32WLxx uses 4 Bits for the Priority Levels */ | ||
#define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */ | ||
#define __FPU_PRESENT 0U /*!< FPU present */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remove warning:
#define __FPU_PRESENT 0U /*!< FPU present */ | |
#define __FPU_PRESENT 0 /*!< FPU present */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forget this comment, keep original file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
@@ -0,0 +1,57 @@ | |||
#! armcc -E |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#! armcc -E | |
#! armclang -E --target=arm-arm-none-eabi -x c -mcpu=cortex-<CORE_TYPE> |
Please make sure the shebang in all scatter files specify armclang
rather than armcc
.🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack
@JeanMarcR see patch on our internal branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…Fully verified with Spec Sheets
…I have done a decent effort to port it / check it. However - Warning - Not everything is verified the the G431 Spec Sheets.
…ile. Added support for USB - connected the HSI48 clock to USB (and RNG). Warning: I'm assuming Flash latency is the same as for G474RE.
…ersion. I have not verified if it is truly needed, but it is better to err on the safe side.
…4 devices has 2 Flash Banks. Fix: Commented out SYSCFG_MEMRMP_FB_MODE since stm32g431KB only has 1 Flash Bank. flash_api.c checks for this #define and if it's set understands it as if the chip has 2 flash banks. STM32G4xx_HAL_Driver/stm32g4xx_hal.c also needs to check for this #define since it has flash bank swapping commands that are called in the startup sequence. Fix: Check for SYSCFG_MEMRMP_FB_MODE in Enable/Disable Flash bank swapping.
…ing has been fixed on G4xxx level (ARMmbed/mbed-os patch ARMmbed#14149)
… physical USBDEVICE should define it in targets.json)
…with RNG clock fixes. Removing USB Clock enablement (USB will not work out-of-the box but will require users to modify system_clock.c to enable its clock) - this inline with changes to targets.json where I removed the USBDEVICE define
…eripheralPins.py -t M40_Nucleo_NUCLEO-G431KB'. Had to do some modifications since the autogenerated files contained errors.
The Mbed TLS Greentea tests can now be built with CMake.
Set DOMAIN_NS=1 only for _NS cores. We had it otherway around. I verified one non NS target that was failing to build, plus also checked the old tools that had this definitions: ``` 91: "Cortex-M23-NS": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "DOMAIN_NS=1", 92 "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], 93 "Cortex-M23": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "__CMSIS_RTOS", 94 "__MBED_CMSIS_RTOS_CM"], ```
@@ -323,7 +323,7 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32 | |||
core_util_critical_section_enter(); | |||
|
|||
/* Enable SYSCFG Clock */ | |||
#if !defined(TARGET_STM32WB) | |||
#if (!defined(TARGET_STM32WB) && !defined(TARGET_STM32WL)) | |||
__HAL_RCC_SYSCFG_CLK_ENABLE(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this file, there is
if defined(DUAL_CORE)
without && (H7) ==> to be added
Good catch @ludoch-stm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
3a2a264
to
bc4def6
Compare
…on. Also added so that the CK48 Clock Mux selects HSI48 for both RNG and USB. Without these the RNG/USB will be clocked at PLLQ (170 MHz) and not work.
…e HSI48 CLK for USB. Assumption is that the STM32G4 reset value (defaults to HSI48 selected for USB) is preserved throughout Mbed initialization.
…bedtls CMake: Add support for Mbed TLS Greentea tests
CMake cores: fix cpu/fpu flags
b727e38
to
7f6d593
Compare
Expose the public Stream API
…vert BLE: return OK when stopping advertising set that is not active
LoraRadio test update for baremetal support
Support for ST STM32 NUCLEO-G431KB Development Board
Add cortex-m55 to CMake support
CMake cores: fix NS cores
Set executable suffix in CMake
CMake: rename greentea test macro
Adding USB HS Support to the SDP-K1
STM: Fix Hal_GetTick wrap around errors
Move the mbed_set_mbed_target_linker_script function into its own file and make it set the linkerscript on the target passed in, rather than setting the linkerscript on the top level mbed-core target. We use CMake's automatic forwarding of usage requirements to forward the linker script to the top level target. This commit also adds a condition to check whether the MBED_TARGET is a CMake buildsystem target. If it is we will just link to it in the idiomatic CMake way, if it's not then we use the 'old' mechanism of setting the linkerscript for the mbed-core target. This check will be useful when we refactor MBED_TARGETS to be CMake buildsystem targets as it will allow us to do the refactoring incrementally.
Refactor all ST targets to be CMake buildsystem targets. This removes the need for checking MBED_TARGET_LABELS repeatedly and allows us to be more flexible in the way we include MBED_TARGET source in the build. A side effect of this is it will allow us to support custom targets without breaking the build for 'standard' targets, as we use CMake's standard mechanism for adding build rules to the build system, rather than implementing our own layer of logic to exclude files not needed for the target being built. Using this approach, if an MBED_TARGET is not linked to using `target_link_libraries` its source files will not be added to the build. This means custom target source can be added to the user's application CMakeLists.txt without polluting the build system when trying to compile for a standard MBED_TARGET.
…actor-st-mbed-targets Refactor ST Mbed targets to be CMake buildsystem targets
BlockDevices: specify mbed namespace where needed
Add code concerning all STM32 platforms
Add code concerning all STM32WL platforms - STM32 Cube Firmware Update CMakeLists.txt due to mbedtools evolution
Add code concerning all STM32WL55xC platforms - Scatter loader and start-up files for ARM, GCC and IAR compilers. - cmsis file - Update CMakeLists.txt due to mbtools evolution
Add code concerning all STM32WL55JC platforms - system clock, pin and peripheral definition mbedtools make file Modify CmakeList to adapt to mbedtools evolution
Add STM32WL information in targets.json file
Add STM32WL information in index.json file Adding sector
Add link option in file used for compilation. Due to a bug in mbedtools environment.
11b34d8
to
6220ca5
Compare
Many test stub functions are meant to return a value, but weren't. Clang would generate a warning for each instance where we weren't returning anything in a function that was meant to return a value. warning: non-void function does not return a value [-Wreturn-type] For a specific example, my_radio::time_on_air() is supposed to return a uint32_t, but wasn't returning anything. We'll return a zero instead of relying on undefined behavior. Without this, clang 11.0.1 was generating a virtual function implementation with a `ud2` instruction to abort at run-time, causing some execution of some unit tests to abort. Running main() from gmock_main.cc [==========] Running 10 tests from 1 test suite. [----------] Global test environment set-up. [----------] 10 tests from Test_LoRaPHYUS915 [ RUN ] Test_LoRaPHYUS915.constructor [ OK ] Test_LoRaPHYUS915.constructor (0 ms) [ RUN ] Test_LoRaPHYUS915.restore_default_channels [ OK ] Test_LoRaPHYUS915.restore_default_channels (0 ms) [ RUN ] Test_LoRaPHYUS915.rx_config [ OK ] Test_LoRaPHYUS915.rx_config (0 ms) [ RUN ] Test_LoRaPHYUS915.tx_config Process 35669 stopped * thread #1, name = 'lorawan-loraphy-', stop reason = signal SIGILL: privileged instruction frame #0: 0x0000000000276f73 lorawan-loraphy-us915-unittest`my_radio::time_on_air(this=0x0000000800c2b048, modem=MODEM_LORA, pkt_len='\0') at Test_LoRaPHYUS915.cpp:90:5 87 }; 88 89 virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) -> 90 { 91 }; 92 93 virtual bool perform_carrier_sense(radio_modems_t modem, (lldb) disassemble --pc lorawan-loraphy-us915-unittest`my_radio::time_on_air: -> 0x276f73 <+67>: ud2 0x276f75: int3 0x276f76: int3 0x276f77: int3 (lldb)
Summary of changes
We would like to introduce the new STM32WL family.
Complementing the STM32 RF connectivity portfolio, the STM32WL System-On-Chip integrates both a general purpose microcontroller and a sub-GHz radio on the same chip.
Built on Arm® Cortex®‐M4 and Cortex®-M0+ cores (single- and dual-core architectures available - 48 MHz), STM32WL microcontrollers support multiple modulations– LoRa®, (G)FSK, (G)MSK, BPSK – to ensure flexibility in wireless applications with LoRaWAN®, Sigfox, W-MBUS or any other suitable protocol in a fully open way.
Thanks to a deep integration, the innovative and open architecture is optimized for LoRaWAN® legacy, Sigfox, proprietary protocols, flexible resource use, power management and helps lower BOM cost while offering a better user experience.
Developed using the same technology as the one implemented in our ultra-low-power STM32L4 microcontrollers, the STM32WL series provides similar digital and analog peripherals for basic or complex application use cases requiring an extended battery life and a long RF range through its sub-GHz transceiver.
To ensure worldwide compatibility, the STM32WL MCUs feature a dual power output and a wide linear frequency range fitting any unlicensed RF spectrum need.
Overall, the STM32WL series is the STM32 family’s pioneer in sub-GHz wireless connectivity, offering ease-of-use and reliability, while being perfectly tailored for a wide range of industrial and consumer applications.
Cube FW files are now available:
https://www.st.com/en/embedded-software/stm32cubewl.html
MBED-OS port has been implemented for NUCLEO_WL55JC target:
256 Kbytes of Flash memory
64 Kbytes of SRAM
https://www.st.com/en/microcontrollers-microprocessors/stm32wl55jc.html
Impact of changes
Migration actions required
Documentation
Pull request type
Test results
Reviewers