### Timer Start Example (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html
An example demonstrating how to create a periodic timer using osTimerNew and then start it using osTimerStart. It includes error checking for the status returned by osTimerStart.
```c
#include "cmsis_os2.h"
void Timer_Callback (void *arg) { // timer callback function
// arg contains &exec
// called every second after osTimerStart
}
uint32_t exec; // argument for the timer call back function
void TimerStart_example (void) {
osTimerId_t id; // timer id
uint32_t timerDelay; // timer value
osStatus_t status; // function return status
// Create periodic timer
exec = 1U;
id = osTimerNew(Timer_Callback, osTimerPeriodic, &exec, NULL);
if (id != NULL) {
timerDelay = 1000U;
status = osTimerStart(id, timerDelay); // start timer
if (status != osOK) {
// Timer could not be started
}
}
;
}
```
--------------------------------
### Timer Stop Example (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html
An example demonstrating how to create and start a timer, and then subsequently stop it using osTimerStop. It includes error checking for the status returned by osTimerStop.
```c
#include "cmsis_os2.h"
void Timer_Callback (void *arg); // prototype for timer callback function
uint32_t exec; // argument for the timer call back function
void TimerStop_example (void) {
osTimerId_t id; // timer id
osStatus_t status; // function return status
// Create periodic timer
exec = 1U;
id = osTimerNew(Timer_Callback, osTimerPeriodic, &exec, NULL);
osTimerStart(id, 1000U); // start timer
:
status = osTimerStop(id); // stop timer
if (status != osOK) {
// Timer could not be stopped
}
;
}
```
--------------------------------
### Initialize and Get WiFi Module Info Example (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Driver/html/group__wifi__control__gr.html
An example demonstrating how to initialize the WiFi driver, power it on, and then retrieve module information using ARM_WIFI_GetModuleInfo. This example assumes the existence of a Driver_WiFi0 instance.
```c
extern ARM_DRIVER_WIFI Driver_WiFi0;
static ARM_DRIVER_WIFI *wifi;
void initialize_wifi (void) {
char info[32];
wifi = &Driver_WiFi0;
// Initialize and Power-on WiFi Module
wifi->Initialize(NULL);
wifi->PowerControl(ARM_POWER_FULL);
// Retrieve module information
wifi->GetModuleInfo(&info, sizeof(info));
}
```
--------------------------------
### Install Example Dependencies in Virtual Environment
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/DSP/PythonWrapper/README.md
Installs necessary Python packages (numpy, scipy, matplotlib) within an activated virtual environment. These packages are required to run the example scripts provided with the CMSIS-DSP wrapper.
```bash
> pip install numpy
> pip install scipy
> pip install matplotlib
```
--------------------------------
### CMake Installation Rule for Executable
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/DSP/Examples/ARM/arm_variance_example/CMakeLists.txt
Specifies the installation rule for the built executable 'arm_variance_example'. It defines the target to be installed and the destination directory within the project source structure.
```cmake
install (TARGETS arm_variance_example DESTINATION "${PROJECT_SOURCE_DIR}/varianceExampleBuild.axf")
```
--------------------------------
### STM32WB Flash Driver Initialization and Operation Example (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Driver/html/group__flash__interface__gr.html
This C code snippet demonstrates the setup and usage of the STM32WB Flash driver within a CMSIS-RTOS2 environment. It includes initializing the driver, controlling power states, reading data, and handling asynchronous events via a callback function. Dependencies include 'Driver_Flash.h' and 'cmsis_os2.h'.
```c
#include "Driver_Flash.h"
#include "cmsis_os2.h" // ARM::CMSIS:RTOS2:Keil RTX5
/* Flash driver instance */
extern ARM_DRIVER_FLASH Driver_Flash0;
static ARM_DRIVER_FLASH *flashDev = &Driver_Flash0;
/* CMSIS-RTOS2 Thread Id */
osThreadId_t Flash_Thread_Id;
/* Flash signal event */
void Flash_Callback(uint32_t event)
{
if (event & ARM_FLASH_EVENT_READY) {
/* The read/program/erase operation is completed */
osThreadFlagsSet(Flash_Thread_Id, 1U);
}
if (event & ARM_FLASH_EVENT_ERROR) {
/* The read/program/erase operation is completed with errors */
/* Call debugger or replace with custom error handling */
__breakpoint(0);
}
}
/* CMSIS-RTOS2 Thread */
void Flash_Thread (void *argument)
{
/* Query drivers capabilities */
const ARM_FLASH_CAPABILITIES capabilities = flashDev->GetCapabilities();
/* Initialize Flash device */
if (capabilities.event_ready) {
flashDev->Initialize (&Flash_Callback);
} else {
flashDev->Initialize (NULL);
}
/* Power-on Flash device */
flashDev->PowerControl (ARM_POWER_FULL);
/* Read data taking data_width into account */
uint8_t buf[256U];
flashDev->ReadData (0x1000U, buf, sizeof(buf)>>capabilities.data_width);
/* Wait operation to be completed */
if (capabilities.event_ready) {
osThreadFlagsWait (1U, osFlagsWaitAny, 100U);
} else {
osDelay(100U);
}
/* Switch off gracefully */
flashDev->PowerControl (ARM_POWER_OFF);
flashDev->Uninitialize ();
}
```
--------------------------------
### Ethernet MAC and PHY Driver Initialization Example (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Driver/html/group__eth__interface__gr.html
This C code snippet demonstrates the typical setup sequence for initializing the Ethernet MAC and PHY drivers. It assumes the availability of external driver structures.
```c
extern ARM_DRIVER_ETH_MAC Driver_ETH_MAC0;
extern ARM_DRIVER_ETH_PHY Driver_ETH_PHY0;
// Example setup sequence (details omitted for brevity)
// Driver_ETH_MAC0.Initialize(...);
// Driver_ETH_PHY0.Initialize(...);
// ...
```
--------------------------------
### Define Board for Example Project
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_examples_pg.html
Specifies the board to be used with an example project. Requires vendor and name attributes. Optional attributes like Dvendor, Dfamily, DsubFamily, and Dname can provide further device-specific details.
```xml
```
--------------------------------
### Specify Example Project Attributes
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_examples_pg.html
Defines attributes for an example project, including categories, components, and keywords. Categories help filter examples, while components list related software elements. Keywords facilitate searching.
```xml
Example Project
For a specific board
Blinky
Getting Started
```
--------------------------------
### Package Examples API
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_examples_pg.html
The /package/examples element serves as a grouping element for all example projects within a CMSIS-Pack. It can contain multiple 'example' child elements, each describing a distinct project.
```APIDOC
## GET /package/examples
### Description
Retrieves a list of all example projects available within the CMSIS-Pack.
### Method
GET
### Endpoint
/package/examples
### Parameters
None
### Request Example
None
### Response
#### Success Response (200)
- **examples** (array) - An array of example objects, each detailing a specific project.
- **name** (string) - The name of the example.
- **folder** (string) - The relative path to the example's base folder.
- **doc** (string) - The document describing the example.
- **version** (string) - The version of the example.
- **description** (string) - A brief description of the example's purpose.
- **board** (object) - Information about the target board.
- **vendor** (string) - The vendor of the board.
- **name** (string) - The name of the board.
- **project** (array) - An array of project environment configurations.
- **environment** (string) - The development environment (e.g., 'uv', 'iar').
- **load** (string) - The path to the project file for the environment.
- **attributes** (object) - Attributes related to the example.
- **component** (array) - Required components for the example.
- **Cclass** (string) - Component class.
- **Cgroup** (string) - Component group.
- **Csub** (string) - Component subgroup (optional).
- **Cversion** (string) - Component version (optional).
- **keyword** (array) - Keywords associated with the example.
#### Response Example
```json
{
"examples": [
{
"name": "Blinky",
"folder": "Boards/MCBSTM32F200/Blinky",
"doc": "Abstract.txt",
"version": "1.0",
"description": "This is a basic example demonstrating the development flow and letting the LED on the board blink",
"board": {
"vendor": "STMicroelectronics",
"name": "32F429IDISCOVERY"
},
"project": [
{
"environment": "uv",
"load": "ARM/Blinky.uvproj"
},
{
"environment": "iar",
"load": "IAR/Blinky.ewarm"
}
],
"attributes": {
"component": [
{
"Cclass": "CMSIS",
"Cgroup": "Core"
},
{
"Cclass": "Device",
"Cgroup": "Startup"
}
],
"keyword": [
"Blinky",
"Getting Started"
]
}
}
]
}
```
```
--------------------------------
### Create and Start Periodic Timer (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__TimerMgmt.html
This snippet demonstrates how to create and start a periodic timer using the CMSIS-RTOS API. It involves defining the timer, creating it with a callback function and periodic interval, and then starting it. Error handling is included to check if the timer was successfully started.
```c
#include "cmsis_os.h"
void Timer_Callback (void const *arg); // prototype for timer callback function
osTimerDef(Timer, Timer_Callback); // define timer
void TimerStart_example (void) {
osTimerId id; // timer id
osStatus status; // function return status
int exec;
// Create periodic timer
exec = 1;
id = osTimerCreate(osTimer(Timer), osTimerPeriodic, NULL);
status = osTimerStart(id, 1000); // start timer
if (status != osOK) {
// Timer could not be started
}
// ... other operations ...
status = osTimerStop(id); // stop timer
if (status != osOK) {
// Timer could not be stopped
}
osTimerStart(id, 1000); // start timer again
}
```
--------------------------------
### STM32WB P-256/SHA-256 Key Generation and Signing Example
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Projects/P-NUCLEO-WB55.Nucleo/Examples/PKA/PKA_ECDSA_Sign/Src/SigGen.txt
This snippet demonstrates a typical sequence of cryptographic operations on the STM32WB, likely involving key generation and signature creation using the P-256 elliptic curve and SHA-256 hash function. The variables 'Msg', 'd', 'Qx', 'Qy', 'k', 'R', and 'S' represent different stages or components of these cryptographic processes.
```plaintext
Msg = 52e5c308e70329a17c71eaedb66bbee303c8ec48a6f1a2efb235d308563cd58553d434e12f353227a9ea28608ec9c820ed83c95124e7a886f7e832a2de1032e78dc059208f9ec354170b2b1cab992b52ac01e6c0e4e1b0112686962edc53ab226dafcc9fc7baed2cd9307160e8572edb125935db49289b178f35a8ad23f4f801
d = 52ad53e849e30bec0e6345c3e9d98ebc808b19496c1ef16d72ab4a00bbb8c634
Qx = 7cca1334bfc2a78728c50b370399be3f9690d445aa03c701da643eeb0b0f7fa8
Qy = 3f7522238668e615405e49b2f63faee58286000a30cdb4b564ac0df99bc8950f
k = 8650c30712fc253610884fbba4a332a4574d4b7822f7776cab1df8f5fa05442a
R = a18194c7ac5829afc408d78dde19542837e7be82706c3941b2d9c5e036bb51e0
S = 188ead1cdf7c1d21114ff56d0421ffd501ab978ef58337462c0fa736d86299af
Msg = d3e9e82051d4c84d699453c9ff44c7c09f6523bb92232bcf30bf3c380224249de2964e871d56a364d6955c81ef91d06482a6c7c61bc70f66ef22fad128d15416e7174312619134f968f1009f92cbf99248932efb533ff113fb6d949e21d6b80dfbbe69010c8d1ccb0f3808ea309bb0bac1a222168c95b088847e613749b19d04
d = 80754962a864be1803bc441fa331e126005bfc6d8b09ed38b7e69d9a030a5d27
Qx = 0aaeed6dd1ae020d6eefc98ec4241ac93cbd3c8afed05bb28007e7da5727571b
Qy = 2dda1d5b7872eb94dfffb456115037ff8d3e72f8ebdd8fcfc42391f96809be69
k = 738e050aeefe54ecba5be5f93a97bbcb7557d701f9da2d7e88483454b97b55a8
R = 8cb9f41dfdcb9604e0725ac9b78fc0db916dc071186ee982f6dba3da36f02efa
S = 5c87fe868fd4282fb114f5d70e9590a10a5d35cedf3ff6402ba5c4344738a32e
Msg = 968951c2c1918436fe19fa2fe2152656a08f9a6b8aa6201920f1b424da98cee71928897ff087620cc5c551320b1e75a1e98d7d98a5bd5361c9393759614a6087cc0f7fb01fcb173783eb4c4c23961a8231ac4a07d72e683b0c1bd4c51ef1b031df875e7b8d5a6e0628949f5b8f157f43dccaea3b2a4fc11181e6b451e06ceb37
d = cfa8c8bd810eb0d73585f36280ecdd296ee098511be8ad5eac68984eca8eb19d
Qx = c227a2af15dfa8734e11c0c50f77e24e77ed58dd8cccf1b0e9fa06bee1c64766
Qy = b686592ce3745eb300d2704083db55e1fa8274e4cb7e256889ccc0bb34a60570
k = 2d6b449bb38b543d6b6d34ff8cb053f5e5b337f949b069b21f421995ebb28823
R = 5e89d3c9b103c2fa3cb8cebeec23640acda0257d63ffbe2d509bfc49fab1dca6
S = d70c5b1eeb29e016af9925798d24e166c23d58fedd2f1a3bbdb1ef78cdbfb63a
Msg = 78048628932e1c1cdd1e70932bd7b76f704ba08d7e7d825d3de763bf1a062315f4af16eccefe0b6ebadccaf403d013f50833ce2c54e24eea8345e25f93b69bb048988d102240225ceacf5003e2abdcc90299f4bf2c101585d36ecdd7a155953c674789d070480d1ef47cc7858e97a6d87c41c6922a00ea12539f251826e141b4
d = b2021e2665ce543b7feadd0cd5a4bd57ffcc5b32deb860b4d736d9880855da3c
Qx = 722e0abad4504b7832a148746153777694714eca220eced2b2156ca64cfed3dd
Qy = f0351b357b3081e859c46cad5328c5afa10546e92bc6c3fd541796ac30397a75
k = b15bbce4b382145de7ecd670d947e77555ef7cd1693bd53c694e2b52b04d10e1
R = 9d086dcd22da165a43091991bede9c1c14515e656633cb759ec2c17f51c35253
S = 23595ad1cb714559faaecaf946beb9a71e584616030ceaed8a8470f4bf62768f
Msg = 9b0800c443e693067591737fdbcf0966fdfa50872d41d0c189d87cbc34c2771ee5e1255fd604f09fcf167fda16437c245d299147299c69046895d22482db29aba37ff57f756716cd3d6223077f747c4caffbecc0a7c9dfaaafd9a9817470ded8777e6355838ac54d11b2f0fc3f43668ff949cc31de0c2d15af5ef17884e4d66a
d = 0c9bce6a568ca239395fc3552755575cbcdddb1d89f6f5ab354517a057b17b48
Qx = 4814d454495df7103e2da383aba55f7842fd84f1750ee5801ad32c10d0be6c7d
Qy = a0bd039d5097c8f0770477f6b18d247876e88e528bf0453eab515ffab8a9eda3
k = d414f1525cdcc41eba1652de017c034ebcc7946cb2efe4713d09f67c85b83153
R = 84db02c678f9a21208cec8564d145a35ba8c6f26b4eb7e19522e439720dae44c
S = 537c564da0d2dc5ac4376c5f0ca3b628d01d48df47a83d842c927e4d6db1e16d
[P-256,SHA-256]
Msg = 5905238877c77421f73e43ee3da6f2d9e2ccad5fc942dcec0cbd25482935faaf416983fe165b1a045ee2bcd2e6dca3bdf46c4310a7461f9a37960ca672d3feb5473e253605fb1ddfd28065b53cb5858a8ad28175bf9bd386a5e471ea7a65c17cc934a9d791e91491eb3754d03799790fe2d308d16146d5c9b0d0debd97d79ce8
d = 519b423d715f8b581f4fa8ee59f4771a5b44c8130b4e3eacca54a56dda72b464
Qx = 1ccbe91c075fc7f4f033bfa248db8fccd3565de94bbfb12f3c59ff46c271bf83
Qy = ce4014c68811f9a21a1fdb2c0e6113e06db7ca93b7404e78dc7ccd5ca89a4ca9
k = 94a1bbb14b906a61a280f245f9e93c7f3b4a6247824f5d33b9670787642a68de
R = f3ac8061b514795b8843e3d6629527ed2afd6b1f6a555a7acabb5e6f79c8c2ac
S = 8bf77819ca05a6b2786c76262bf7371cef97b218e96f175a3ccdda2acc058903
```
--------------------------------
### Echo Server Implementation Example (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Driver/html/group__wifi__socket__gr.html
An example demonstrating how to create an echo server using STM32WB WiFi socket functions. It includes socket creation, binding, listening, accepting connections, receiving data, and sending it back to the client.
```c
extern ARM_DRIVER_WIFI Driver_WiFi0;
static ARM_DRIVER_WIFI *wifi;
void Echo_Server_Thread (void *arg) {
uint8_t ip[4] = { 0U, 0U, 0U, 0U };
int32_t sock, sd, res;
char dbuf[120];
while (1) {
wifi = &Driver_WiFi0;
sock = wifi->SocketCreate(ARM_SOCKET_AF_INET, ARM_SOCKET_SOCK_STREAM, ARM_SOCKET_IPPROTO_TCP);
wifi->SocketBind(sock, (uint8_t *)ip, sizeof(ip), 7U);
wifi->SocketListen(sock, 1);
sd = wifi->SocketAccept(sock, NULL, NULL, NULL);
wifi->SocketClose(sock);
sock = sd;
while (1) {
res = wifi->SocketRecv(sock, dbuf, sizeof(dbuf));
if (res < 0) {
break; // Error occurred
}
if (res > 0) {
wifi->SocketSend(sock, dbuf, res); // Echo the data
}
}
wifi->SocketClose(sock);
}
}
```
--------------------------------
### Initialize and Use Semaphore (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__SemaphoreMgmt.html
Demonstrates the basic steps to declare, create, acquire, and release a semaphore. This involves defining the semaphore, creating it with a specific number of tokens, waiting to acquire a token, and releasing it when done. The semaphore can be used to manage access to shared resources.
```c
#define MY_SEMAPHORE_MAX_TOKENS 4
osSemaphoreDef(my_semaphore);
osSemaphoreId my_semaphore_id;
void initialize_semaphore() {
my_semaphore_id = osSemaphoreCreate(osSemaphore(my_semaphore), MY_SEMAPHORE_MAX_TOKENS);
}
void use_resource() {
if (my_semaphore_id != NULL) {
osSemaphoreWait(my_semaphore_id, osWaitForever);
// Access the shared resource
// ...
osSemaphoreRelease(my_semaphore_id);
}
}
```
--------------------------------
### EvrRtxKernelStart Function
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__rtx__evr__kernel.html
Logs the call to start the RTOS kernel.
```APIDOC
## EvrRtxKernelStart Function
### Description
Logs the call to start the RTOS kernel using the `osKernelStart` function.
### Method
POST
### Endpoint
/kernel/start
### Parameters
None
### Request Example
```json
{
"message": "Calling osKernelStart"
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the call was logged.
#### Response Example
```json
{
"status": "logged"
}
```
```
--------------------------------
### Example: Working with CMSIS-RTOS Message Queues (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__Message.html
Demonstrates the steps to set up, create, and populate a message queue using CMSIS-RTOS functions. It includes defining the queue, creating it, and putting data into it.
```c
// 1. Setup the message queue:
osMessageQDef(message_q, 5, uint32_t); // Declare a message queue
osMessageQId (message_q_id); // Declare an ID for the message queue
// 2. Then, create the message queue in a thread:
message_q_id = osMessageCreate([osMessageQ](group__CMSIS__RTOS__Message.html#ga2d446a0b4bb90bf05d6f92eedeaabc97)(message_q), NULL);
// 3. Fill the message queue with data:
uint32_t data = 512;
osMailPut(message_q_id, data, osWaitForever);
```
--------------------------------
### CMSIS-DAP v2 WinUSB Configuration (.inf file)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/DAP/html/group__DAP__ConfigUSB__gr.html
This .inf file is used for Windows 7 host PCs to install the CMSIS-DAP v2 device with WinUSB support. It defines the device class, GUID, and installation services.
```inf
[Version]
Signature = "$Windows NT$"
Class = USBDevice
ClassGUID = {88BAE032-5A81-49f0-BC3D-A4FF138216D6}
Provider = %ManufacturerName%
DriverVer = 04/13/2016, 1.0.0.0
CatalogFile.nt = CMSIS_DAP_v2_x86.cat
CatalogFile.ntx86 = CMSIS_DAP_v2_x86.cat
CatalogFile.ntamd64 = CMSIS_DAP_v2_amd64.cat
; ========== Manufacturer/Models sections ===========
[Manufacturer]
%ManufacturerName% = Devices, NTx86, NTamd64
[Devices.NTx86]
%DeviceName% = USB_Install, USB\VID_c251&PID_f000
[Devices.NTamd64]
%DeviceName% = USB_Install, USB\VID_c251&PID_f000
; ========== Class definition ===========
[ClassInstall32]
AddReg = ClassInstall_AddReg
[ClassInstall_AddReg]
HKR,,,,%ClassName%
HKR,,NoInstallClass,,1
HKR,,IconPath,0x10000,"%%SystemRoot%%\System32\setupapi.dll,-20"
HKR,,LowerLogoVersion,,5.2
; =================== Installation ===================
[USB_Install]
Include = winusb.inf
Needs = WINUSB.NT
[USB_Install.Services]
Include = winusb.inf
Needs = WINUSB.NT.Services
[USB_Install.HW]
AddReg = Dev_AddReg
[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{CDB3B5AD-293B-4663-AA36-1AAE46463776}"
; =================== Strings ===================
[Strings]
ClassName = "Universal Serial Bus devices"
ManufacturerName = "KEIL - Tools By ARM"
DeviceName = "CMSIS-DAP v2"
```
--------------------------------
### NVIC_GetVector
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Core/html/group__compiler__conntrol__gr.html
Retrieves the address of the interrupt vector for a given IRQn. This function is typically used to get the starting address of the interrupt handler for a specific interrupt.
```APIDOC
## NVIC_GetVector
### Description
Retrieves the address of the interrupt vector for a given IRQn.
### Method
GET (Conceptual - this is a function call, not an HTTP endpoint)
### Endpoint
N/A
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```c
IRQn_Type irq = PendSV_IRQn;
uint32_t vector_address = NVIC_GetVector(irq);
```
### Response
#### Success Response (200)
- **vector_address** (uint32_t) - The memory address of the interrupt vector.
#### Response Example
```json
{
"vector_address": "0x20001000"
}
```
```
--------------------------------
### Start Kernel (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__rtx__evr__kernel.html
Logs the event when the osKernelStart function is called, indicating the initiation of the RTOS kernel's execution. This is a preparatory event before the kernel is fully started.
```c
void EvrRtxKernelStart(
void
)
{
// Event recording logic for KernelStart
}
```
--------------------------------
### Book Configuration
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_boards_pg.html
Provides information about documentation parts related to a development board, such as setup guides or user manuals.
```APIDOC
## POST /package/boards/board/book
### Description
The element provides information about documentation parts related to a development board. At least one book must be defined.
### Method
POST
### Endpoint
/package/boards/board/book
### Parameters
#### Request Body
- **category** (string) - required - Category of the book (e.g., 'setup').
- **name** (string) - required - Path to the documentation file (e.g., 'Documents/UM1662.pdf').
- **title** (string) - required - Title of the documentation part (e.g., 'Getting Started').
### Request Example
```xml
```
### Response
#### Success Response (200)
- **message** (string) - Confirmation message.
#### Response Example
```json
{
"message": "Book information added successfully."
}
```
```
--------------------------------
### Device Memory Region Configuration (XML Example)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_family_pg.html
Example of how to define memory regions for a device within the STM32WB family configuration. This includes SRAM, SRAM1, SRAM2, and Flash memory with their respective access permissions, start addresses, and sizes.
```XML
```
--------------------------------
### Initialize and Start CMSIS-RTOS Kernel
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__KernelCtrl.html
This C code snippet demonstrates the basic initialization and startup of the CMSIS-RTOS kernel within the main function. It first calls osKernelInitialize() to set up the kernel, then allows for peripheral initialization and thread creation before finally calling osKernelStart() to begin thread execution.
```c
int main (void) {
[osKernelInitialize](group__CMSIS__RTOS__KernelCtrl.html#ga53d078a801022e202e8115c083ece68e) (); // initialize CMSIS-RTOS
// initialize peripherals here
// create 'thread' functions that start executing,
// example: tid_name = osThreadCreate (osThread(name), NULL);
[osKernelStart](group__CMSIS__RTOS__KernelCtrl.html#gaab668ffd2ea76bb0a77ab0ab385eaef2) (); // start thread execution
}
```
--------------------------------
### STM32 Programmer CLI: Latest FUS Upgrade
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/Release_Notes.html
This command performs a firmware upgrade for the latest FUS version, starting from FUS v1.2.0. It utilizes the STM32 Programmer CLI via USB. The 'Install@' parameter specifies the target address, and 'firstinstall=0' indicates it's not the initial installation.
```bash
STM32_Programmer_CLI.exe -c port=usb1 -fwupgrade "stm32wb5x_FUS_fw.bin" "Install@" firstinstall=0
```
--------------------------------
### Initialize and Start RTX Kernel (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS2/html/os2MigrationGuide.html
This C code snippet demonstrates the initialization and starting of the RTX Kernel. It includes system initialization, updating the system core clock, initializing the CMSIS-RTOS kernel, creating a new thread for the application main function, and starting the RTOS scheduler. This is a fundamental step for any application using RTX5.
```c
#include "RTE_Components.h"
#include CMSIS_device_header
void app_main (void const *argument) {
// contents of old "main"
}
osThreadDef(app_main, osPriorityNormal, 1, 0);
int main (void) {
// System Initialization
SystemCoreClockUpdate();
// ...
osKernelInitialize();
osThreadCreate(osThread(app_main), NULL);
osKernelStart();
for (;;);
}
```
--------------------------------
### MPU Functions (A-Prefix)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Core/html/globals_func_a.html
This section details the MPU configuration and control functions starting with 'ARM_MPU_'. These functions allow for the setup and management of memory regions and protection attributes.
```APIDOC
## MPU Functions (A-Prefix)
### Description
Provides functions for configuring and controlling the Memory Protection Unit (MPU) on Cortex-M processors. This includes enabling/disabling the MPU, setting memory regions, attributes, and clearing configurations.
### Method
N/A (These are C functions, not REST API endpoints)
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
### Function Details:
* **ARM_MPU_ClrRegion()**
* Description: Clears a specific MPU region.
* Referenced in: Ref_MPU.txt, Ref_MPU8.txt
* **ARM_MPU_ClrRegion_NS()**
* Description: Clears a specific Non-Secure MPU region.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_ClrRegionEx()**
* Description: Clears a specific MPU region with extended options.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_Disable()**
* Description: Disables the MPU.
* Referenced in: Ref_MPU.txt, Ref_MPU8.txt
* **ARM_MPU_Disable_NS()**
* Description: Disables the Non-Secure MPU.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_Enable()**
* Description: Enables the MPU.
* Referenced in: Ref_MPU.txt, Ref_MPU8.txt
* **ARM_MPU_Enable_NS()**
* Description: Enables the Non-Secure MPU.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_Load()**
* Description: Loads MPU region configuration.
* Referenced in: Ref_MPU.txt, Ref_MPU8.txt
* **ARM_MPU_Load_NS()**
* Description: Loads Non-Secure MPU region configuration.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_LoadEx()**
* Description: Loads MPU region configuration with extended options.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_OrderedMemcpy()**
* Description: Performs an ordered memory copy, potentially respecting MPU settings.
* Referenced in: Ref_MPU.txt, Ref_MPU8.txt
* **ARM_MPU_SetMemAttr()**
* Description: Sets memory attributes for a specific region.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_SetMemAttr_NS()**
* Description: Sets Non-Secure memory attributes for a specific region.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_SetMemAttrEx()**
* Description: Sets memory attributes with extended options.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_SetRegion()**
* Description: Sets up a specific MPU region.
* Referenced in: Ref_MPU8.txt, Ref_MPU.txt
* **ARM_MPU_SetRegion_NS()**
* Description: Sets up a specific Non-Secure MPU region.
* Referenced in: Ref_MPU8.txt
* **ARM_MPU_SetRegionEx()**
* Description: Sets up a specific MPU region with extended options.
* Referenced in: Ref_MPU8.txt, Ref_MPU.txt
```
--------------------------------
### KernelStart Event
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__rtx__evr__kernel.html
Logs the initiation of the RTOS kernel start process.
```APIDOC
## KernelStart Event
### Description
This event is generated when the `osKernelStart` function is called.
```
--------------------------------
### CMSIS-RTOS Thread Creation and Management Example (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS/html/usingOS.html
This C code example demonstrates how to initialize the CMSIS-RTOS kernel, define and create multiple threads (job1, job2, job3) with different priorities and delays, and start the RTOS kernel. It requires the 'cmsis_os.h' header file.
```c
#include "cmsis_os.h" // CMSIS-RTOS header file
void job1 (void const *argument) { // thread function 'job1'
while (1) {
// execute some code
osDelay (10); // delay execution for 10 milliseconds
}
}
osThreadDef(job1, osPriorityAboveNormal, 1, 0); // define job1 as thread function
void job2 (void const *argument) { // thread function 'job2'
osThreadCreate(osThread(job1),NULL); // create job1 thread
while (1) {
// execute some code
}
}
osThreadDef(job2, osPriorityNormal, 1, 0); // define job2 as thread function
void job3 (void const *argument) { // thread function 'job3'
while (1) {
// execute some code
osDelay (20); // delay execution for 20 milliseconds
}
}
osThreadDef(job3, osPriorityNormal, 1, 0); // define job3 as thread function
int main (void) { // program execution starts here
osKernelInitialize (); // initialize RTOS kernel
// setup and initialize peripherals
osThreadCreate(osThread(job2));
osThreadCreate(osThread(job3));
osKernelStart (); // start kernel with job2 execution
}
```
--------------------------------
### Configure Project Environments and Load Files
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_examples_pg.html
Defines the environments and project files to be loaded for an example project. Each environment requires a name (tool-chain) and a load path for the project file. Multiple environments can be specified.
```xml
```
--------------------------------
### Start FUS via SWD using STM32CubeProgrammer CLI
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB3x/Release_Notes.html
This command initiates the Firmware Upgrade Service (FUS) when connected via SWD. It requires the STM32CubeProgrammer CLI to be installed and accessible in the system's PATH.
```bash
STM32_Programmer_CLI.exe -c port=swd -startfus
```
--------------------------------
### CMSIS-RTOS RTX Round-Robin Multitasking Example (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS/html/systemConfig.html
Demonstrates the setup and execution of round-robin multitasking in CMSIS-RTOS RTX. This example creates two threads, job1 and job2, which increment counters. The RTX kernel schedules these threads using round-robin, allowing them to share CPU time in time slices. It requires the 'cmsis_os.h' header file.
```c
#include "cmsis_os.h" // CMSIS-RTOS header file
int counter1;
int counter2;
void job1 (void const *arg) {
while (1) { // loop forever
counter1++; // update the counter
}
}
void job2 (void const *arg) {
while (1) { // loop forever
counter2++; // update the counter
}
}
osThreadDef(job1, osPriorityAboveNormal, 1, 0);
osThreadDef(job2, osPriorityAboveNormal, 1, 0);
int main (void) {
osKernelInitialize(); // setup kernel
osThreadCreate(osThread(job1), NULL); // create threads
osThreadCreate(osThread(job2), NULL);
osKernelStart(); // start kernel
}
```
--------------------------------
### Kernel Started Confirmation (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__rtx__evr__kernel.html
Confirms that the RTOS kernel execution has been successfully started by the osKernelStart function. This event signifies the completion of the kernel startup process.
```c
void EvrRtxKernelStarted(
void
)
{
// Event recording logic for KernelStarted
}
```
--------------------------------
### Configure Tamper Pin and Interrupt (C)
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Projects/P-NUCLEO-WB55.Nucleo/Examples/RTC/RTC_Tamper/readme.txt
Configures the tamper pin (PC13) to trigger on a falling edge and enables the associated tamper interrupt. This setup is part of the tamper detection mechanism.
```c
RTC_TamperTypeDef sTamper;
sTamper.Tamper = RTC_TAMPER_1;
sTamper.Pull = RTC_TAMPER_NO_PULL;
sTamper.DebounceFilter = RTC_TAMPER_DB_DISABLE;
sTamper.Frequency = RTC_TAMPER_FREQ_DIV1;
sTamper.Antidamping = RTC_TAMPER_ANTIDAMPING_DISABLE;
sTamper.Preload = RTC_TAMPER_PRELOAD_ENABLE;
sTamper.OutputType = RTC_TAMPER_OUTPUT_NONE;
sTamper.TamperInterrupt = RTC_TAMPER_INTERRUPT_ENABLE;
sTamper.TamperMask = RTC_TAMPER_MASK_NONE;
if (HAL_RTCEx_SetTamper(hrtc, &sTamper) != HAL_OK)
{
/* Initialization Error */
Error_Handler();
}
```
--------------------------------
### Define Program Entry Point with __PROGRAM_START
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Drivers/CMSIS/docs/Core/html/group__compiler__conntrol__gr.html
The __PROGRAM_START macro specifies the function to be jumped into immediately after low-level initialization (SystemInit). This is compiler and library specific, with CMSIS providing common defaults. It is intended for use within the startup file.
```c
#define __PROGRAM_START
void Reset_Handler(void)
{
SystemInit(); /* CMSIS System Initialization */
__PROGRAM_START(); /* Enter PreMain (C library entry point) */
}
```
--------------------------------
### Linker Script Configuration for Flash Size
Source: https://github.com/stmicroelectronics/stm32cubewb/blob/master/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB3x/Release_Notes.html
Example of modifying the ICFEDIT_region_ROM_end in a linker file to define the maximum flash memory usable by an application. This value is constrained by the Secure Flash Start Address (SFSA) option byte.
```c
The ICFEDIT_region_ROM_end in the linker can be modified with a value up to : (0x08000000 + (SFSA << 12)) - 1.
```