04 - First Project On SW4STM32
04 - First Project On SW4STM32
T.O.M.A.S Team
2
IMPORT project
into workspace
1
3
Select project location
(as configured in STM32CubeMX –
Step2)
2
4
Import the project into the workspace 3/3
10
SW4STM32
2. Add 500ms delay between each change of the GPIO pin state. Which function we can use here?
?
Hints:
• All HAL function begins with HAL_PPP_ prefix (PPP – short name of the peripheral, i.e. GPIO)
• Please try to use Content Assistant (Ctrl+SPACE) in Eclipse
Modifying the code
13
blinking green LED (PA5) - solution
Solutions (within while(1) loop in main.c):
1. Add GPIO pin toggle function for PA5 pin. Which function we can use here?
HAL_GPIO_TogglePin();
2. Add 500ms delay between each change of the GPIO pin state. Which function we can use here?
HAL_Delay();
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
1. Configure C standard to
C99 to avoid possible
compilation errors
4
3
Run the debug session in SW4STM32
for multiple projects in the workspace, but no board specification 19
2
3
4
Debug session perspective
20
watching the variables
• This is possible to monitor CPU registers, peripherals registers and variables during debug session,
but we need to pause the code execution (no live view is possible for the time being).
• To add variable to be monitored - highlight it, press right mouse button and select “Add Watch
Expression”. It will appear in Expressions tab then.
• Values which has changed from previous project pause will be presented on yellow background
Watched variables
Values changed
from previous
application pause
Debug session perspective
21
watching the registers content
• This is possible to monitor CPU registers, peripherals registers and variables during debug session,
but we need to pause the code execution (no live view is possible for the time being).
• To add peripheral register to watch - click right mouse button and select “Activate”. Peripheral icon
and its registers names will be highlighted in green and will contain “caught” values on next debug
pause.
• Values which has changed from previous project pause will be highlighted in red.
Peripherals
Core registers registers
Non-watched
peripheral Value changed
from previous
Watched application pause
peripheral
Handling the debug session
22
SW4STM32
1 2 3 4 5 6 7 8
www.st.com/mcu