├── .gitattributes
├── Create-Task-Tutorial
├── Output-uart
│ └── Capture.PNG
├── README.md
└── src
│ ├── it.c
│ ├── main.c
│ ├── msp.c
│ ├── syscalls.c
│ └── system_stm32f3xx.c
├── Create_Bin_Semaphore
├── README.md
└── src
│ ├── it.c
│ ├── main.c
│ ├── msp.c
│ ├── syscalls.c
│ └── system_stm32f3xx.c
├── Free-template
├── .cproject
├── .project
├── .settings
│ └── language.settings.xml
├── CMSIS
│ ├── core
│ │ ├── arm_common_tables.h
│ │ ├── arm_const_structs.h
│ │ ├── arm_math.h
│ │ ├── cmsis_armcc.h
│ │ ├── cmsis_armcc_V6.h
│ │ ├── cmsis_gcc.h
│ │ ├── core_cm0.h
│ │ ├── core_cm0plus.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm7.h
│ │ ├── core_cmFunc.h
│ │ ├── core_cmInstr.h
│ │ ├── core_cmSimd.h
│ │ ├── core_sc000.h
│ │ └── core_sc300.h
│ └── device
│ │ ├── stm32f301x8.h
│ │ ├── stm32f302x8.h
│ │ ├── stm32f302xc.h
│ │ ├── stm32f302xe.h
│ │ ├── stm32f303x8.h
│ │ ├── stm32f303xc.h
│ │ ├── stm32f303xe.h
│ │ ├── stm32f318xx.h
│ │ ├── stm32f328xx.h
│ │ ├── stm32f334x8.h
│ │ ├── stm32f358xx.h
│ │ ├── stm32f373xc.h
│ │ ├── stm32f378xx.h
│ │ ├── stm32f398xx.h
│ │ ├── stm32f3xx.h
│ │ └── system_stm32f3xx.h
├── Debug
│ ├── .gitignore
│ ├── Free-template.elf
│ └── output.map
├── Final Debug.cfg
├── HAL_Driver
│ ├── Inc
│ │ ├── Legacy
│ │ │ ├── stm32_hal_legacy.h
│ │ │ └── stm32f3xx_hal_can_legacy.h
│ │ ├── stm32_assert_template.h
│ │ ├── stm32f3xx_hal.h
│ │ ├── stm32f3xx_hal_adc.h
│ │ ├── stm32f3xx_hal_adc_ex.h
│ │ ├── stm32f3xx_hal_can.h
│ │ ├── stm32f3xx_hal_cec.h
│ │ ├── stm32f3xx_hal_comp.h
│ │ ├── stm32f3xx_hal_comp_ex.h
│ │ ├── stm32f3xx_hal_conf.h
│ │ ├── stm32f3xx_hal_cortex.h
│ │ ├── stm32f3xx_hal_crc.h
│ │ ├── stm32f3xx_hal_crc_ex.h
│ │ ├── stm32f3xx_hal_dac.h
│ │ ├── stm32f3xx_hal_dac_ex.h
│ │ ├── stm32f3xx_hal_def.h
│ │ ├── stm32f3xx_hal_dma.h
│ │ ├── stm32f3xx_hal_dma_ex.h
│ │ ├── stm32f3xx_hal_flash.h
│ │ ├── stm32f3xx_hal_flash_ex.h
│ │ ├── stm32f3xx_hal_gpio.h
│ │ ├── stm32f3xx_hal_gpio_ex.h
│ │ ├── stm32f3xx_hal_hrtim.h
│ │ ├── stm32f3xx_hal_i2c.h
│ │ ├── stm32f3xx_hal_i2c_ex.h
│ │ ├── stm32f3xx_hal_i2s.h
│ │ ├── stm32f3xx_hal_i2s_ex.h
│ │ ├── stm32f3xx_hal_irda.h
│ │ ├── stm32f3xx_hal_irda_ex.h
│ │ ├── stm32f3xx_hal_iwdg.h
│ │ ├── stm32f3xx_hal_nand.h
│ │ ├── stm32f3xx_hal_nor.h
│ │ ├── stm32f3xx_hal_opamp.h
│ │ ├── stm32f3xx_hal_opamp_ex.h
│ │ ├── stm32f3xx_hal_pccard.h
│ │ ├── stm32f3xx_hal_pcd.h
│ │ ├── stm32f3xx_hal_pcd_ex.h
│ │ ├── stm32f3xx_hal_pwr.h
│ │ ├── stm32f3xx_hal_pwr_ex.h
│ │ ├── stm32f3xx_hal_rcc.h
│ │ ├── stm32f3xx_hal_rcc_ex.h
│ │ ├── stm32f3xx_hal_rtc.h
│ │ ├── stm32f3xx_hal_rtc_ex.h
│ │ ├── stm32f3xx_hal_sdadc.h
│ │ ├── stm32f3xx_hal_smartcard.h
│ │ ├── stm32f3xx_hal_smartcard_ex.h
│ │ ├── stm32f3xx_hal_smbus.h
│ │ ├── stm32f3xx_hal_spi.h
│ │ ├── stm32f3xx_hal_spi_ex.h
│ │ ├── stm32f3xx_hal_sram.h
│ │ ├── stm32f3xx_hal_tim.h
│ │ ├── stm32f3xx_hal_tim_ex.h
│ │ ├── stm32f3xx_hal_tsc.h
│ │ ├── stm32f3xx_hal_uart.h
│ │ ├── stm32f3xx_hal_uart_ex.h
│ │ ├── stm32f3xx_hal_usart.h
│ │ ├── stm32f3xx_hal_usart_ex.h
│ │ ├── stm32f3xx_hal_wwdg.h
│ │ ├── stm32f3xx_ll_adc.h
│ │ ├── stm32f3xx_ll_bus.h
│ │ ├── stm32f3xx_ll_comp.h
│ │ ├── stm32f3xx_ll_cortex.h
│ │ ├── stm32f3xx_ll_crc.h
│ │ ├── stm32f3xx_ll_dac.h
│ │ ├── stm32f3xx_ll_dma.h
│ │ ├── stm32f3xx_ll_exti.h
│ │ ├── stm32f3xx_ll_fmc.h
│ │ ├── stm32f3xx_ll_gpio.h
│ │ ├── stm32f3xx_ll_hrtim.h
│ │ ├── stm32f3xx_ll_i2c.h
│ │ ├── stm32f3xx_ll_iwdg.h
│ │ ├── stm32f3xx_ll_opamp.h
│ │ ├── stm32f3xx_ll_pwr.h
│ │ ├── stm32f3xx_ll_rcc.h
│ │ ├── stm32f3xx_ll_rtc.h
│ │ ├── stm32f3xx_ll_spi.h
│ │ ├── stm32f3xx_ll_system.h
│ │ ├── stm32f3xx_ll_tim.h
│ │ ├── stm32f3xx_ll_usart.h
│ │ ├── stm32f3xx_ll_utils.h
│ │ └── stm32f3xx_ll_wwdg.h
│ ├── STM32F303xC_User_Manual.chm
│ ├── STM32F334x8_User_Manual.chm
│ ├── STM32F373xC_User_Manual.chm
│ └── Src
│ │ ├── Legacy
│ │ └── stm32f3xx_hal_can.c
│ │ ├── stm32f3xx_hal.c
│ │ ├── stm32f3xx_hal_adc.c
│ │ ├── stm32f3xx_hal_adc_ex.c
│ │ ├── stm32f3xx_hal_cec.c
│ │ ├── stm32f3xx_hal_comp.c
│ │ ├── stm32f3xx_hal_cortex.c
│ │ ├── stm32f3xx_hal_crc.c
│ │ ├── stm32f3xx_hal_crc_ex.c
│ │ ├── stm32f3xx_hal_dac.c
│ │ ├── stm32f3xx_hal_dac_ex.c
│ │ ├── stm32f3xx_hal_dma.c
│ │ ├── stm32f3xx_hal_flash.c
│ │ ├── stm32f3xx_hal_flash_ex.c
│ │ ├── stm32f3xx_hal_gpio.c
│ │ ├── stm32f3xx_hal_hrtim.c
│ │ ├── stm32f3xx_hal_i2c.c
│ │ ├── stm32f3xx_hal_i2c_ex.c
│ │ ├── stm32f3xx_hal_i2s.c
│ │ ├── stm32f3xx_hal_i2s_ex.c
│ │ ├── stm32f3xx_hal_irda.c
│ │ ├── stm32f3xx_hal_iwdg.c
│ │ ├── stm32f3xx_hal_msp_template.c
│ │ ├── stm32f3xx_hal_nand.c
│ │ ├── stm32f3xx_hal_nor.c
│ │ ├── stm32f3xx_hal_opamp.c
│ │ ├── stm32f3xx_hal_opamp_ex.c
│ │ ├── stm32f3xx_hal_pccard.c
│ │ ├── stm32f3xx_hal_pcd.c
│ │ ├── stm32f3xx_hal_pcd_ex.c
│ │ ├── stm32f3xx_hal_pwr.c
│ │ ├── stm32f3xx_hal_pwr_ex.c
│ │ ├── stm32f3xx_hal_rcc.c
│ │ ├── stm32f3xx_hal_rcc_ex.c
│ │ ├── stm32f3xx_hal_rtc.c
│ │ ├── stm32f3xx_hal_rtc_ex.c
│ │ ├── stm32f3xx_hal_sdadc.c
│ │ ├── stm32f3xx_hal_smartcard.c
│ │ ├── stm32f3xx_hal_smartcard_ex.c
│ │ ├── stm32f3xx_hal_smbus.c
│ │ ├── stm32f3xx_hal_spi.c
│ │ ├── stm32f3xx_hal_spi_ex.c
│ │ ├── stm32f3xx_hal_sram.c
│ │ ├── stm32f3xx_hal_tim.c
│ │ ├── stm32f3xx_hal_tim_ex.c
│ │ ├── stm32f3xx_hal_timebase_rtc_alarm_template.c
│ │ ├── stm32f3xx_hal_timebase_rtc_wakeup_template.c
│ │ ├── stm32f3xx_hal_timebase_tim_template.c
│ │ ├── stm32f3xx_hal_tsc.c
│ │ ├── stm32f3xx_hal_uart.c
│ │ ├── stm32f3xx_hal_uart_ex.c
│ │ ├── stm32f3xx_hal_usart.c
│ │ ├── stm32f3xx_hal_wwdg.c
│ │ ├── stm32f3xx_ll_adc.c
│ │ ├── stm32f3xx_ll_comp.c
│ │ ├── stm32f3xx_ll_crc.c
│ │ ├── stm32f3xx_ll_dac.c
│ │ ├── stm32f3xx_ll_dma.c
│ │ ├── stm32f3xx_ll_exti.c
│ │ ├── stm32f3xx_ll_fmc.c
│ │ ├── stm32f3xx_ll_gpio.c
│ │ ├── stm32f3xx_ll_hrtim.c
│ │ ├── stm32f3xx_ll_i2c.c
│ │ ├── stm32f3xx_ll_opamp.c
│ │ ├── stm32f3xx_ll_pwr.c
│ │ ├── stm32f3xx_ll_rcc.c
│ │ ├── stm32f3xx_ll_rtc.c
│ │ ├── stm32f3xx_ll_spi.c
│ │ ├── stm32f3xx_ll_tim.c
│ │ ├── stm32f3xx_ll_usart.c
│ │ └── stm32f3xx_ll_utils.c
├── LED_button_Task Debug (1).cfg
├── LED_button_Task Debug.cfg
├── LinkerScript.ld
├── Middlewares
│ └── Third_Party
│ │ ├── FreeRTOS
│ │ └── org
│ │ │ ├── License
│ │ │ └── license.txt
│ │ │ └── Source
│ │ │ ├── croutine.c
│ │ │ ├── event_groups.c
│ │ │ ├── include
│ │ │ ├── FreeRTOS.h
│ │ │ ├── StackMacros.h
│ │ │ ├── atomic.h
│ │ │ ├── croutine.h
│ │ │ ├── deprecated_definitions.h
│ │ │ ├── event_groups.h
│ │ │ ├── list.h
│ │ │ ├── message_buffer.h
│ │ │ ├── mpu_prototypes.h
│ │ │ ├── mpu_wrappers.h
│ │ │ ├── portable.h
│ │ │ ├── projdefs.h
│ │ │ ├── queue.h
│ │ │ ├── semphr.h
│ │ │ ├── stack_macros.h
│ │ │ ├── stdint.readme
│ │ │ ├── stream_buffer.h
│ │ │ ├── task.h
│ │ │ └── timers.h
│ │ │ ├── list.c
│ │ │ ├── portable
│ │ │ ├── GCC
│ │ │ │ └── ARM_CM4F
│ │ │ │ │ ├── port.c
│ │ │ │ │ └── portmacro.h
│ │ │ └── MemMang
│ │ │ │ ├── ReadMe.url
│ │ │ │ └── heap_4.c
│ │ │ ├── queue.c
│ │ │ ├── readme.txt
│ │ │ ├── st_readme.txt
│ │ │ ├── stream_buffer.c
│ │ │ ├── tasks.c
│ │ │ └── timers.c
│ │ └── SEGGER
│ │ ├── Config
│ │ ├── Global.h
│ │ ├── SEGGER_RTT_Conf.h
│ │ ├── SEGGER_SYSVIEW_Conf.h
│ │ └── SEGGER_SYSVIEW_Config_FreeRTOS.c
│ │ ├── OS
│ │ ├── SEGGER_SYSVIEW_FreeRTOS.c
│ │ └── SEGGER_SYSVIEW_FreeRTOS.h
│ │ ├── Patch
│ │ ├── FreeRTOSV10_Core.patch
│ │ └── FreeRTOSv10.1.1
│ │ │ └── FreeRTOSV10_Core.patch
│ │ └── SEGGER
│ │ ├── SEGGER.h
│ │ ├── SEGGER_RTT.c
│ │ ├── SEGGER_RTT.h
│ │ ├── SEGGER_RTT_ASM_ARMv7M.S
│ │ ├── SEGGER_RTT_printf.c
│ │ ├── SEGGER_SYSVIEW.c
│ │ ├── SEGGER_SYSVIEW.h
│ │ ├── SEGGER_SYSVIEW_ConfDefaults.h
│ │ └── SEGGER_SYSVIEW_Int.h
├── NUCLEO-F303RE.xml
├── README.md
├── SEGGGER_Dump
│ ├── 001.SVdat
│ └── 002.SVdat
├── Utilities
│ └── STM32F3xx-Nucleo
│ │ ├── Release_Notes.html
│ │ ├── STM32F3xx-Nucleo_BSP_User_Manual.chm
│ │ ├── stm32f3xx_nucleo.c
│ │ └── stm32f3xx_nucleo.h
├── inc
│ └── FreeRTOSConfig.h
├── src
│ ├── it.c
│ ├── main.c
│ ├── msp.c
│ ├── syscalls.c
│ └── system_stm32f3xx.c
└── startup
│ └── startup_stm32f303xe.s
├── LED_Button_Delete_Task
├── README.md
├── SEGGGER_Dump
│ └── 001.SVdat
├── output-image
│ ├── Capture.PNG
│ └── IMG20221212215953.gif
└── src
│ ├── it.c
│ ├── main.c
│ ├── msp.c
│ ├── syscalls.c
│ └── system_stm32f3xx.c
├── LED_button_Notfiy
├── Middlewares
│ └── Third_Party
│ │ ├── FreeRTOS
│ │ └── org
│ │ │ └── Source
│ │ │ ├── croutine.c
│ │ │ ├── event_groups.c
│ │ │ ├── include
│ │ │ ├── FreeRTOS.h
│ │ │ ├── StackMacros.h
│ │ │ ├── atomic.h
│ │ │ ├── croutine.h
│ │ │ ├── deprecated_definitions.h
│ │ │ ├── event_groups.h
│ │ │ ├── list.h
│ │ │ ├── message_buffer.h
│ │ │ ├── mpu_prototypes.h
│ │ │ ├── mpu_wrappers.h
│ │ │ ├── portable.h
│ │ │ ├── projdefs.h
│ │ │ ├── queue.h
│ │ │ ├── semphr.h
│ │ │ ├── stack_macros.h
│ │ │ ├── stream_buffer.h
│ │ │ ├── task.h
│ │ │ └── timers.h
│ │ │ ├── list.c
│ │ │ ├── portable
│ │ │ ├── GCC
│ │ │ │ └── ARM_CM4F
│ │ │ │ │ ├── port.c
│ │ │ │ │ └── portmacro.h
│ │ │ └── MemMang
│ │ │ │ └── heap_4.c
│ │ │ ├── queue.c
│ │ │ ├── stream_buffer.c
│ │ │ ├── tasks.c
│ │ │ └── timers.c
│ │ └── SEGGER
│ │ ├── Config
│ │ ├── Global.h
│ │ ├── SEGGER_RTT_Conf.h
│ │ ├── SEGGER_SYSVIEW_Conf.h
│ │ └── SEGGER_SYSVIEW_Config_FreeRTOS.c
│ │ ├── OS
│ │ ├── SEGGER_SYSVIEW_FreeRTOS.c
│ │ └── SEGGER_SYSVIEW_FreeRTOS.h
│ │ └── SEGGER
│ │ ├── SEGGER.h
│ │ ├── SEGGER_RTT.c
│ │ ├── SEGGER_RTT.h
│ │ ├── SEGGER_RTT_printf.c
│ │ ├── SEGGER_SYSVIEW.c
│ │ ├── SEGGER_SYSVIEW.h
│ │ ├── SEGGER_SYSVIEW_ConfDefaults.h
│ │ └── SEGGER_SYSVIEW_Int.h
├── README.md
├── SEGGGER_Dump
│ ├── 001.SVdat
│ └── 002.SVdat
├── Utilities
│ └── STM32F3xx-Nucleo
│ │ ├── stm32f3xx_nucleo.c
│ │ └── stm32f3xx_nucleo.h
├── inc
│ ├── FreeRTOSConfig.h
│ └── inc
│ │ └── FreeRTOSConfig.h
├── output-image
│ └── Capture.PNG
└── src
│ ├── it.c
│ ├── main.c
│ ├── msp.c
│ ├── syscalls.c
│ └── system_stm32f3xx.c
├── Queue_Create
├── README.md
└── src
│ ├── it.c
│ ├── main.c
│ ├── msp.c
│ ├── syscalls.c
│ └── system_stm32f3xx.c
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/Create-Task-Tutorial/Output-uart/Capture.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Create-Task-Tutorial/Output-uart/Capture.PNG
--------------------------------------------------------------------------------
/Create-Task-Tutorial/README.md:
--------------------------------------------------------------------------------
1 | **In previous section we explanid the the FreeRTOS templte we gonna use in this basic tutorial*
2 |
3 | In this part we will learn how to mcreate the task which is the basic structure of the RTOS\
4 |
5 | # Syntex
6 | __BaseType_t xTaskCreate__( TaskFunction_t pxTaskCode,
7 | const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
8 | const configSTACK_DEPTH_TYPE usStackDepth,
9 | void * const pvParameters,
10 | UBaseType_t uxPriority,
11 | TaskHandle_t * const pxCreatedTask )
12 |
13 | __vTaskStartScheduler()__;
14 | - Starts the RTOS scheduler. After calling the RTOS kernel has control over which tasks are executed
15 |
16 | __taskYIELD()__
17 | - Is used to request a context switch to another task. Without this function the the process only see one task\
18 |
19 | **this function used to create task with some intial parameters**
20 | - TaskFunction_t pxTaskCode : which is the address of the task the task is the some line of code in function form
21 | - const char * const pcName: The name of the task it is better to make a name for every task
22 | - const configSTACK_DEPTH_TYPE usStackDepth: the stack size you this task gonna take in the system
23 | - void * const pvParameters: parameter you wanna pass if needed
24 | - UBaseType_t uxPriorit: the proirity of the taske the lower number the higher priorty
25 | - TaskHandle_t * const pxCreatedTask: Type by which tasks are referenced. For example, a call to xTaskCreate returns (via a pointer parameter) an TaskHandle_t variable that can then be used as a parameter to vTaskDelete to delete the task.
26 |
27 |
28 | ## Work flow
29 |
30 | 1. first create task 1 and task 2
31 | 2. Call the scheduler (by vTaskStartScheduler())
32 |
33 | watch the output in the output file ;)
34 |
--------------------------------------------------------------------------------
/Create-Task-Tutorial/src/it.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx.h"
2 | #include "stm32f3xx_nucleo.h"
3 |
4 | extern USART_HandleTypeDef uart;
5 | void SysTick_Handler(void)
6 | {
7 | // HAL_IncTick();
8 | //HAL_SYSTICK_IRQHandler();
9 | }
10 | void USART2_IRQHandler(void)
11 | {
12 |
13 | HAL_UART_IRQHandler(&uart);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Create-Task-Tutorial/src/main.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file main.c
4 | * @author Abdallah rabie
5 | * @version V1.0
6 | * @date 01-December-2013
7 | * @brief Default main function.
8 | ******************************************************************************
9 | */
10 |
11 | #include "stm32f3xx.h"
12 | #include "stm32f3xx_nucleo.h"
13 | #include "FreeRTOS.h"
14 | #include "task.h"
15 | #include "string.h"
16 | #include "SEGGER_SYSVIEW.h"
17 |
18 | //some macros
19 |
20 | //Task handles
21 | TaskHandle_t xTaskHandler1 = NULL;
22 | TaskHandle_t xTaskHandler2 = NULL;
23 | TaskFunction_t pxTaskCode;
24 |
25 | //Functions
26 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
27 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG);
28 | void USART2_init(void); //UART peripheral Initialization
29 | void GPIO_Init(); // Hardware to work with UART
30 | void Error_handler();
31 | void prm(char *msg);
32 | void TaskOne(void *params); //FreeRTOS standard function for tasks
33 | void TaskTwo(void *params);
34 |
35 | UART_HandleTypeDef uart;
36 | char user_data[250];
37 |
38 | int main(void) {
39 |
40 | DWT->CTRL |= (1 << 0);
41 |
42 | HAL_Init();
43 | GPIO_Init();
44 | USART2_init();
45 |
46 | SEGGER_SYSVIEW_Conf();
47 | SEGGER_SYSVIEW_Start();
48 | // Task Creation
49 | xTaskCreate(TaskOne, "Task 1", configMINIMAL_STACK_SIZE, NULL, 1,
50 | &xTaskHandler1);
51 | xTaskCreate(TaskTwo, "Task 2", configMINIMAL_STACK_SIZE, NULL, 1,
52 | &xTaskHandler2);
53 | vTaskStartScheduler();
54 | for (;;)
55 | ;
56 | }
57 |
58 | void USART2_init(void) {
59 |
60 | uart.Instance = USART2;
61 | uart.Init.BaudRate = 115200;
62 | uart.Init.Mode = USART_MODE_TX_RX;
63 | uart.Init.WordLength = UART_WORDLENGTH_8B;
64 | uart.Init.StopBits = USART_STOPBITS_1;
65 | uart.Init.Parity = USART_PARITY_NONE;
66 | uart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
67 | uart.Init.OverSampling = UART_OVERSAMPLING_16;
68 | while (HAL_UART_Init(&uart) != HAL_OK) {
69 | Error_handler();
70 | }
71 |
72 | }
73 |
74 | void GPIO_Init() {
75 |
76 | GPIO_InitTypeDef led_gpio, button_gpio;
77 | __HAL_RCC_GPIOA_CLK_ENABLE()
78 | ;
79 | __HAL_RCC_GPIOC_CLK_ENABLE()
80 | ;
81 | led_gpio.Mode = GPIO_MODE_OUTPUT_PP;
82 | led_gpio.Pin = GPIO_PIN_5;
83 | led_gpio.Speed = GPIO_SPEED_FREQ_MEDIUM;
84 | led_gpio.Pull = GPIO_NOPULL;
85 | HAL_GPIO_Init(GPIOA, &led_gpio);
86 |
87 | button_gpio.Mode = GPIO_MODE_INPUT;
88 | button_gpio.Pin = GPIO_PIN_13;
89 | button_gpio.Speed = GPIO_SPEED_FREQ_MEDIUM;
90 | button_gpio.Pull = GPIO_NOPULL;
91 | HAL_GPIO_Init(GPIOC, &button_gpio);
92 |
93 | }
94 | void Error_handler() {
95 |
96 | while (1)
97 | ;
98 | }
99 | void prm(char *msg) {
100 | uint16_t len = strlen(msg);
101 | //HAL_UART_Transmit(&uart, (uint8_t *) msg, len, HAL_MAX_DELAY);
102 | for (uint32_t i = 0; i < len; i++) {
103 | while (USART_GetFlagStatus(USART2, USART_FLAG_TXE) != SET)
104 | ;
105 | USART_SendData(USART2, msg[i]);
106 | }
107 |
108 | }
109 |
110 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data) {
111 | /* Transmit Data */
112 | USARTx->TDR = (Data & (uint16_t) 0x01FF);
113 | }
114 |
115 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG) {
116 | uint8_t bitstatus = RESET;
117 |
118 | if ((USARTx->ISR & USART_FLAG) != (uint16_t) RESET) {
119 | bitstatus = SET;
120 | } else {
121 | bitstatus = RESET;
122 | }
123 | return bitstatus;
124 | }
125 |
126 | void TaskOne(void *params){
127 | while (1) {
128 | prm("Hello world task1\r\n");
129 | taskYIELD();
130 | }
131 | //taskYIELD();
132 | }
133 | void TaskTwo(void *params){
134 | while (1) {
135 | prm("Hello world task2\r\n");
136 | taskYIELD();
137 | }
138 | //taskYIELD();
139 | }
140 |
141 |
--------------------------------------------------------------------------------
/Create-Task-Tutorial/src/msp.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx_hal.h"
2 |
3 | void HAL_UART_MspInit(UART_HandleTypeDef *huart)
4 | {
5 | __HAL_RCC_USART2_CLK_ENABLE();
6 | __HAL_RCC_GPIOA_CLK_ENABLE();
7 |
8 | GPIO_InitTypeDef gpio_init;
9 | gpio_init.Pin = GPIO_PIN_2 | GPIO_PIN_3;
10 | gpio_init.Mode = GPIO_MODE_AF_PP;
11 | gpio_init.Pull = GPIO_NOPULL;
12 | gpio_init.Alternate = GPIO_AF7_USART2;
13 |
14 | HAL_GPIO_Init(GPIOA , &gpio_init);
15 |
16 | HAL_NVIC_EnableIRQ(USART2_IRQn);
17 |
18 | HAL_NVIC_SetPriority(USART2_IRQn, 15, 0);
19 | }
20 | void HAL_MspInit(void)
21 | {
22 | NVIC_SetPriorityGrouping( 0 );
23 | }
24 |
--------------------------------------------------------------------------------
/Create-Task-Tutorial/src/syscalls.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Create-Task-Tutorial/src/syscalls.c
--------------------------------------------------------------------------------
/Create_Bin_Semaphore/README.md:
--------------------------------------------------------------------------------
1 | # Binary Semaphore
2 |
3 | - If you dont know about semaphore check this link(https://www.geeksforgeeks.org/semaphores-in-process-synchronization/)
4 |
5 | ## In this part New Functions APIs we gonna use:
6 |
7 | - vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore )
8 |
9 |
10 | ## Parameters:
11 | - xSemaphore Handle to the created semaphore. Should be of type SemaphoreHandle_t.
12 |
13 | - xSemaphoreTake( SemaphoreHandle_t xSemaphore,
14 | TickType_t xTicksToWait );
15 |
16 | ## Parameters:
17 | - xSemaphore A handle to the semaphore being taken - obtained when the semaphore was created.
18 | - xTicksToWait The time in ticks to wait for the semaphore to become available. The macro portTICK_PERIOD_MS can be used to convert this to a real time. A block time of zero can be used to poll the semaphore.
19 |
20 | ## Returns:
21 | pdTRUE if the semaphore was obtained. pdFALSE if xTicksToWait expired without the semaphore becoming available.
22 |
23 | - xSemaphoreGive( SemaphoreHandle_t xSemaphore );
24 |
25 | ## Parameters:
26 | - xSemaphore A handle to the semaphore being released. This is the handle returned when the semaphore was created.
27 |
28 | ## Returns:
29 | pdTRUE if the semaphore was released. pdFALSE if an error occurred. Semaphores are implemented using queues. An error can occur if there is no space on the queue to post a message - indicating that the semaphore was not first obtained correctly.
30 |
31 | __Flowcontrol__
32 | - Create two task ,semphore ,queue
33 | - The first task has piroity greater than the second
34 | - The semaphore would take the handle and goes into loop
35 | - Send the id to the queue
36 | - IF the return == pass the data added succefully
37 | - Else no space in the queue switch to the second task
38 | - The second task take the semaphore to use and check if the queue recive print id of the taske
39 | - Else the queue is empty
40 |
41 |
42 | 
43 |
--------------------------------------------------------------------------------
/Create_Bin_Semaphore/src/it.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx.h"
2 | #include "stm32f3xx_nucleo.h"
3 |
4 | extern USART_HandleTypeDef uart;
5 |
6 | void USART2_IRQHandler(void)
7 | {
8 |
9 | HAL_UART_IRQHandler(&uart);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/Create_Bin_Semaphore/src/main.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file main.c
4 | * @author Ac6
5 | * @version V1.0
6 | * @date 01-December-2013
7 | * @brief Default main function.
8 | ******************************************************************************
9 | */
10 |
11 | #include "stm32f3xx.h"
12 | #include "stm32f3xx_nucleo.h"
13 | #include "FreeRTOS.h"
14 | #include "task.h"
15 | #include "string.h"
16 | #include "SEGGER_SYSVIEW.h"
17 | #include "semphr.h"
18 | //extern void initialise_monitor_handles();
19 |
20 | //some macros
21 | #define TRUE 1
22 | #define FALSE 0
23 | #define AVAILABLE TRUE
24 | #define NOT_AVAILABLE FALSE
25 |
26 | /*******************Variables**************************/
27 |
28 | uint16_t buttomValue = GPIO_PIN_RESET;
29 | TaskHandle_t xTaskHandler1 = NULL;
30 | TaskHandle_t xTaskHandler2 = NULL;
31 |
32 | xSemaphoreHandle xSemaphoreWork;
33 | xQueueHandle xWorkQueue;
34 |
35 | TaskFunction_t pxTaskCode;
36 | UART_HandleTypeDef uart;
37 | char user_data[250];
38 | uint16_t UART_ACCESS_KEY = AVAILABLE;
39 |
40 | /*******************Functions**************************/
41 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
42 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG);
43 | void USART2_init(void);
44 | void GPIO_Init();
45 | void Error_handler();
46 | void prm(char *msg);
47 | void rtos_delay(uint32_t delay_in_ms);
48 | void vEmployeTask(void *params);
49 | void vMangerTask(void *params);
50 | void EmployeDoWork(unsigned char TicketID);
51 | int main(void) {
52 |
53 | DWT->CTRL |= (1 << 0);
54 | //initialise_monitor_handles();
55 | HAL_Init();
56 | GPIO_Init();
57 | USART2_init();
58 | /*Start SEEGER Captures*/
59 | //SEGGER_SYSVIEW_Conf();
60 | //SEGGER_SYSVIEW_Start();
61 | vSemaphoreCreateBinary(xSemaphoreWork); //Creation
62 | //Ticet ID
63 | xWorkQueue = xQueueCreate(1, sizeof(unsigned int));
64 | /*Create two Taskes*/
65 | if (xSemaphoreWork != NULL && xWorkQueue != NULL) {
66 |
67 | xTaskCreate(vEmployeTask, "Employe Task", 500, NULL, 1, NULL);
68 | xTaskCreate(vMangerTask, "Manger Task", 500, NULL, 3, NULL);
69 |
70 | vTaskStartScheduler();
71 | }
72 | for (;;)
73 | ;
74 | }
75 |
76 | void USART2_init(void) {
77 |
78 | uart.Instance = USART2;
79 | uart.Init.BaudRate = 115200;
80 | uart.Init.Mode = USART_MODE_TX_RX;
81 | uart.Init.WordLength = UART_WORDLENGTH_8B;
82 | uart.Init.StopBits = USART_STOPBITS_1;
83 | uart.Init.Parity = USART_PARITY_NONE;
84 | uart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
85 | uart.Init.OverSampling = UART_OVERSAMPLING_16;
86 | while (HAL_UART_Init(&uart) != HAL_OK) {
87 | Error_handler();
88 | }
89 |
90 | }
91 | void GPIO_Init() {
92 |
93 | GPIO_InitTypeDef led_gpio, button_gpio;
94 | __HAL_RCC_GPIOA_CLK_ENABLE()
95 | ;
96 | __HAL_RCC_GPIOC_CLK_ENABLE()
97 | ;
98 | led_gpio.Mode = GPIO_MODE_OUTPUT_PP;
99 | led_gpio.Pin = GPIO_PIN_5;
100 | led_gpio.Speed = GPIO_SPEED_FREQ_MEDIUM;
101 | led_gpio.Pull = GPIO_NOPULL;
102 | HAL_GPIO_Init(GPIOA, &led_gpio);
103 |
104 | button_gpio.Mode = GPIO_MODE_INPUT;
105 | button_gpio.Pin = GPIO_PIN_13;
106 | button_gpio.Speed = GPIO_SPEED_FREQ_MEDIUM;
107 | button_gpio.Pull = GPIO_NOPULL;
108 | HAL_GPIO_Init(GPIOC, &button_gpio);
109 |
110 | }
111 | void Error_handler() {
112 |
113 | while (1)
114 | ;
115 | }
116 | void vEmployeTask(void *params) {
117 | unsigned int xWorkTicketID;
118 | portBASE_TYPE xStates;
119 | for (;;) {
120 | xSemaphoreTake(xWorkQueue, 0); //Take the semaphore
121 |
122 | xStates = xQueueReceive(xWorkQueue, &xWorkTicketID, 0);
123 | if (xStates == pdPASS) {
124 | EmployeDoWork(xWorkTicketID);
125 |
126 | } else {
127 | sprintf(user_data, "QUEUE Emepty form vEmployeTask \r\n");
128 | prm(user_data);
129 | }
130 | }
131 | }
132 | void vMangerTask(void *params) {
133 | unsigned int xWorkTicketID;
134 | portBASE_TYPE xStates;
135 | xSemaphoreGive(xSemaphoreWork); //intialy empty
136 | for (;;) {
137 | xWorkTicketID = (rand() & 0x1ff);
138 | xStates = xQueueSend(xWorkQueue, &xWorkTicketID, portMAX_DELAY);
139 | if (xStates != pdPASS) { // Added succefully
140 | //if error print
141 | sprintf(user_data, "NOT SENT\r\n");
142 | prm(user_data);
143 | } else {
144 | xSemaphoreGive(xSemaphoreWork);
145 | //switch manuly to other task
146 | taskYIELD();
147 | }
148 |
149 | }
150 |
151 | }
152 | void EmployeDoWork(unsigned char TicketID){
153 | sprintf(user_data,"WORKING on EmployeDoWork :%d\r\n",TicketID);
154 | prm(user_data);
155 | vTaskDelay(TicketID);
156 | }
157 |
158 | void prm(char *msg) {
159 | uint16_t len = strlen(msg);
160 |
161 | for (uint32_t i = 0; i < len; i++) {
162 | while (USART_GetFlagStatus(USART2, USART_FLAG_TXE) != SET)
163 | ;
164 | USART_SendData(USART2, msg[i]);
165 | }
166 | }
167 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data) {
168 | /* Transmit Data */
169 | USARTx->TDR = (Data & (uint16_t) 0x01FF);
170 | }
171 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG) {
172 | uint8_t bitstatus = RESET;
173 |
174 | if ((USARTx->ISR & USART_FLAG) != (uint16_t) RESET) {
175 | bitstatus = SET;
176 | } else {
177 | bitstatus = RESET;
178 | }
179 | return bitstatus;
180 | }
181 |
182 | void rtos_delay(uint32_t delay_in_ms) {
183 |
184 | uint32_t current_ticks = xTaskGetTickCount();
185 | uint32_t delay_in_ticks = (delay_in_ms * configTICK_RATE_HZ) / 1000;
186 | while (xTaskGetTickCount() < (current_ticks + delay_in_ticks))
187 | ;
188 | }
189 |
--------------------------------------------------------------------------------
/Create_Bin_Semaphore/src/msp.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx_hal.h"
2 |
3 | void HAL_UART_MspInit(UART_HandleTypeDef *huart)
4 | {
5 | __HAL_RCC_USART2_CLK_ENABLE();
6 | __HAL_RCC_GPIOA_CLK_ENABLE();
7 |
8 | GPIO_InitTypeDef gpio_init;
9 | gpio_init.Pin = GPIO_PIN_2 | GPIO_PIN_3;
10 | gpio_init.Mode = GPIO_MODE_AF_PP;
11 | gpio_init.Pull = GPIO_NOPULL;
12 | gpio_init.Alternate = GPIO_AF7_USART2;
13 |
14 | HAL_GPIO_Init(GPIOA , &gpio_init);
15 |
16 | HAL_NVIC_EnableIRQ(USART2_IRQn);
17 |
18 | HAL_NVIC_SetPriority(USART2_IRQn, 15, 0);
19 | }
20 | void HAL_MspInit(void)
21 | {
22 | NVIC_SetPriorityGrouping( 0 );
23 | }
24 |
--------------------------------------------------------------------------------
/Create_Bin_Semaphore/src/syscalls.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Create_Bin_Semaphore/src/syscalls.c
--------------------------------------------------------------------------------
/Free-template/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Free-template
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | fr.ac6.mcu.ide.core.MCUProjectNature
26 | fr.ac6.mcu.ide.core.MCUSingleCoreProjectNature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Free-template/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Free-template/CMSIS/core/arm_const_structs.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
3 | *
4 | * $Date: 19. March 2015
5 | * $Revision: V.1.4.5
6 | *
7 | * Project: CMSIS DSP Library
8 | * Title: arm_const_structs.h
9 | *
10 | * Description: This file has constant structs that are initialized for
11 | * user convenience. For example, some can be given as
12 | * arguments to the arm_cfft_f32() function.
13 | *
14 | * Target Processor: Cortex-M4/Cortex-M3
15 | *
16 | * Redistribution and use in source and binary forms, with or without
17 | * modification, are permitted provided that the following conditions
18 | * are met:
19 | * - Redistributions of source code must retain the above copyright
20 | * notice, this list of conditions and the following disclaimer.
21 | * - Redistributions in binary form must reproduce the above copyright
22 | * notice, this list of conditions and the following disclaimer in
23 | * the documentation and/or other materials provided with the
24 | * distribution.
25 | * - Neither the name of ARM LIMITED nor the names of its contributors
26 | * may be used to endorse or promote products derived from this
27 | * software without specific prior written permission.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 | * POSSIBILITY OF SUCH DAMAGE.
41 | * -------------------------------------------------------------------- */
42 |
43 | #ifndef _ARM_CONST_STRUCTS_H
44 | #define _ARM_CONST_STRUCTS_H
45 |
46 | #include "arm_math.h"
47 | #include "arm_common_tables.h"
48 |
49 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16;
50 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32;
51 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64;
52 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128;
53 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256;
54 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512;
55 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024;
56 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048;
57 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096;
58 |
59 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16;
60 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32;
61 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64;
62 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128;
63 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256;
64 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512;
65 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024;
66 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048;
67 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096;
68 |
69 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16;
70 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32;
71 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64;
72 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128;
73 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256;
74 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512;
75 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024;
76 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048;
77 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096;
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/Free-template/CMSIS/core/core_cmFunc.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmFunc.h
3 | * @brief CMSIS Cortex-M Core Function Access Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMFUNC_H
42 | #define __CORE_CMFUNC_H
43 |
44 |
45 | /* ########################### Core Function Access ########################### */
46 | /** \ingroup CMSIS_Core_FunctionInterface
47 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
48 | @{
49 | */
50 |
51 | /*------------------ RealView Compiler -----------------*/
52 | #if defined ( __CC_ARM )
53 | #include "cmsis_armcc.h"
54 |
55 | /*------------------ ARM Compiler V6 -------------------*/
56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
57 | #include "cmsis_armcc_V6.h"
58 |
59 | /*------------------ GNU Compiler ----------------------*/
60 | #elif defined ( __GNUC__ )
61 | #include "cmsis_gcc.h"
62 |
63 | /*------------------ ICC Compiler ----------------------*/
64 | #elif defined ( __ICCARM__ )
65 | #include
66 |
67 | /*------------------ TI CCS Compiler -------------------*/
68 | #elif defined ( __TMS470__ )
69 | #include
70 |
71 | /*------------------ TASKING Compiler ------------------*/
72 | #elif defined ( __TASKING__ )
73 | /*
74 | * The CMSIS functions have been implemented as intrinsics in the compiler.
75 | * Please use "carm -?i" to get an up to date list of all intrinsics,
76 | * Including the CMSIS ones.
77 | */
78 |
79 | /*------------------ COSMIC Compiler -------------------*/
80 | #elif defined ( __CSMC__ )
81 | #include
82 |
83 | #endif
84 |
85 | /*@} end of CMSIS_Core_RegAccFunctions */
86 |
87 | #endif /* __CORE_CMFUNC_H */
88 |
--------------------------------------------------------------------------------
/Free-template/CMSIS/core/core_cmInstr.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmInstr.h
3 | * @brief CMSIS Cortex-M Core Instruction Access Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMINSTR_H
42 | #define __CORE_CMINSTR_H
43 |
44 |
45 | /* ########################## Core Instruction Access ######################### */
46 | /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
47 | Access to dedicated instructions
48 | @{
49 | */
50 |
51 | /*------------------ RealView Compiler -----------------*/
52 | #if defined ( __CC_ARM )
53 | #include "cmsis_armcc.h"
54 |
55 | /*------------------ ARM Compiler V6 -------------------*/
56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
57 | #include "cmsis_armcc_V6.h"
58 |
59 | /*------------------ GNU Compiler ----------------------*/
60 | #elif defined ( __GNUC__ )
61 | #include "cmsis_gcc.h"
62 |
63 | /*------------------ ICC Compiler ----------------------*/
64 | #elif defined ( __ICCARM__ )
65 | #include
66 |
67 | /*------------------ TI CCS Compiler -------------------*/
68 | #elif defined ( __TMS470__ )
69 | #include
70 |
71 | /*------------------ TASKING Compiler ------------------*/
72 | #elif defined ( __TASKING__ )
73 | /*
74 | * The CMSIS functions have been implemented as intrinsics in the compiler.
75 | * Please use "carm -?i" to get an up to date list of all intrinsics,
76 | * Including the CMSIS ones.
77 | */
78 |
79 | /*------------------ COSMIC Compiler -------------------*/
80 | #elif defined ( __CSMC__ )
81 | #include
82 |
83 | #endif
84 |
85 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
86 |
87 | #endif /* __CORE_CMINSTR_H */
88 |
--------------------------------------------------------------------------------
/Free-template/CMSIS/core/core_cmSimd.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmSimd.h
3 | * @brief CMSIS Cortex-M SIMD Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMSIMD_H
42 | #define __CORE_CMSIMD_H
43 |
44 | #ifdef __cplusplus
45 | extern "C" {
46 | #endif
47 |
48 |
49 | /* ################### Compiler specific Intrinsics ########################### */
50 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
51 | Access to dedicated SIMD instructions
52 | @{
53 | */
54 |
55 | /*------------------ RealView Compiler -----------------*/
56 | #if defined ( __CC_ARM )
57 | #include "cmsis_armcc.h"
58 |
59 | /*------------------ ARM Compiler V6 -------------------*/
60 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
61 | #include "cmsis_armcc_V6.h"
62 |
63 | /*------------------ GNU Compiler ----------------------*/
64 | #elif defined ( __GNUC__ )
65 | #include "cmsis_gcc.h"
66 |
67 | /*------------------ ICC Compiler ----------------------*/
68 | #elif defined ( __ICCARM__ )
69 | #include
70 |
71 | /*------------------ TI CCS Compiler -------------------*/
72 | #elif defined ( __TMS470__ )
73 | #include
74 |
75 | /*------------------ TASKING Compiler ------------------*/
76 | #elif defined ( __TASKING__ )
77 | /*
78 | * The CMSIS functions have been implemented as intrinsics in the compiler.
79 | * Please use "carm -?i" to get an up to date list of all intrinsics,
80 | * Including the CMSIS ones.
81 | */
82 |
83 | /*------------------ COSMIC Compiler -------------------*/
84 | #elif defined ( __CSMC__ )
85 | #include
86 |
87 | #endif
88 |
89 | /*@} end of group CMSIS_SIMD_intrinsics */
90 |
91 |
92 | #ifdef __cplusplus
93 | }
94 | #endif
95 |
96 | #endif /* __CORE_CMSIMD_H */
97 |
--------------------------------------------------------------------------------
/Free-template/CMSIS/device/stm32f373xc.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/CMSIS/device/stm32f373xc.h
--------------------------------------------------------------------------------
/Free-template/CMSIS/device/stm32f378xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/CMSIS/device/stm32f378xx.h
--------------------------------------------------------------------------------
/Free-template/CMSIS/device/stm32f3xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/CMSIS/device/stm32f3xx.h
--------------------------------------------------------------------------------
/Free-template/CMSIS/device/system_stm32f3xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f3xx.h
4 | * @author MCD Application Team
5 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F3xx devices.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2016 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 |
36 | /** @addtogroup CMSIS
37 | * @{
38 | */
39 |
40 | /** @addtogroup stm32f3xx_system
41 | * @{
42 | */
43 |
44 | /**
45 | * @brief Define to prevent recursive inclusion
46 | */
47 | #ifndef __SYSTEM_STM32F3XX_H
48 | #define __SYSTEM_STM32F3XX_H
49 |
50 | #ifdef __cplusplus
51 | extern "C" {
52 | #endif
53 |
54 | /** @addtogroup STM32F3xx_System_Includes
55 | * @{
56 | */
57 |
58 | /**
59 | * @}
60 | */
61 |
62 |
63 | /** @addtogroup STM32F3xx_System_Exported_types
64 | * @{
65 | */
66 | /* This variable is updated in three ways:
67 | 1) by calling CMSIS function SystemCoreClockUpdate()
68 | 3) by calling HAL API function HAL_RCC_GetHCLKFreq()
69 | 3) by calling HAL API function HAL_RCC_ClockConfig()
70 | Note: If you use this function to configure the system clock; then there
71 | is no need to call the 2 first functions listed above, since SystemCoreClock
72 | variable is updated automatically.
73 | */
74 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
75 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
76 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
77 |
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | /** @addtogroup STM32F3xx_System_Exported_Constants
84 | * @{
85 | */
86 |
87 | /**
88 | * @}
89 | */
90 |
91 | /** @addtogroup STM32F3xx_System_Exported_Macros
92 | * @{
93 | */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | /** @addtogroup STM32F3xx_System_Exported_Functions
100 | * @{
101 | */
102 |
103 | extern void SystemInit(void);
104 | extern void SystemCoreClockUpdate(void);
105 | /**
106 | * @}
107 | */
108 |
109 | #ifdef __cplusplus
110 | }
111 | #endif
112 |
113 | #endif /*__SYSTEM_STM32F3XX_H */
114 |
115 | /**
116 | * @}
117 | */
118 |
119 | /**
120 | * @}
121 | */
122 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
123 |
--------------------------------------------------------------------------------
/Free-template/Debug/.gitignore:
--------------------------------------------------------------------------------
1 | /HAL_Driver/
2 | /Middlewares/
3 | /Utilities/
4 | /makefile
5 | /objects.list
6 | /objects.mk
7 | /sources.mk
8 | /src/
9 | /startup/
10 |
--------------------------------------------------------------------------------
/Free-template/Debug/Free-template.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/Debug/Free-template.elf
--------------------------------------------------------------------------------
/Free-template/Final Debug.cfg:
--------------------------------------------------------------------------------
1 | # This is an NUCLEO-F303RE board with a single STM32F303RETx chip
2 | #
3 | # Generated by System Workbench for STM32
4 | # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
5 |
6 | source [find interface/stlink.cfg]
7 |
8 | set WORKAREASIZE 0x8000
9 |
10 | transport select "hla_swd"
11 |
12 | set CHIPNAME STM32F303RETx
13 | set BOARDNAME NUCLEO-F303RE
14 |
15 | # CHIPNAMES state
16 | set CHIPNAME_CPU0_ACTIVATED 1
17 |
18 | # Enable debug when in low power modes
19 | set ENABLE_LOW_POWER 1
20 |
21 | # Stop Watchdog counters when halt
22 | set STOP_WATCHDOG 1
23 |
24 | # STlink Debug clock frequency
25 | set CLOCK_FREQ 8000
26 |
27 | # use hardware reset, connect under reset
28 | # connect_assert_srst needed if low power mode application running (WFI...)
29 | reset_config srst_only srst_nogate connect_assert_srst
30 | set CONNECT_UNDER_RESET 1
31 |
32 | # BCTM CPU variables
33 |
34 |
35 |
36 | source [find target/stm32f3x.cfg]
37 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Inc/stm32_assert_template.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32_assert.h
4 | * @author MCD Application Team
5 | * @brief STM32 assert template file.
6 | * This file should be copied to the application folder and renamed
7 | * to stm32_assert.h.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT(c) 2016 STMicroelectronics
12 | *
13 | * Redistribution and use in source and binary forms, with or without modification,
14 | * are permitted provided that the following conditions are met:
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
18 | * this list of conditions and the following disclaimer in the documentation
19 | * and/or other materials provided with the distribution.
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | *
35 | ******************************************************************************
36 | */
37 |
38 | /* Define to prevent recursive inclusion -------------------------------------*/
39 | #ifndef __STM32_ASSERT_H
40 | #define __STM32_ASSERT_H
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 |
46 | /* Exported types ------------------------------------------------------------*/
47 | /* Exported constants --------------------------------------------------------*/
48 | /* Includes ------------------------------------------------------------------*/
49 | /* Exported macro ------------------------------------------------------------*/
50 | #ifdef USE_FULL_ASSERT
51 | /**
52 | * @brief The assert_param macro is used for function's parameters check.
53 | * @param expr If expr is false, it calls assert_failed function
54 | * which reports the name of the source file and the source
55 | * line number of the call that failed.
56 | * If expr is true, it returns no value.
57 | * @retval None
58 | */
59 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((char *)__FILE__, __LINE__))
60 | /* Exported functions ------------------------------------------------------- */
61 | void assert_failed(char* file, uint32_t line);
62 | #else
63 | #define assert_param(expr) ((void)0U)
64 | #endif /* USE_FULL_ASSERT */
65 |
66 | #ifdef __cplusplus
67 | }
68 | #endif
69 |
70 | #endif /* __STM32_ASSERT_H */
71 |
72 |
73 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
74 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Inc/stm32f3xx_hal_crc_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_hal_crc_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of CRC HAL extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2016 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 |
36 | /* Define to prevent recursive inclusion -------------------------------------*/
37 | #ifndef __STM32F3xx_HAL_CRC_EX_H
38 | #define __STM32F3xx_HAL_CRC_EX_H
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | /* Includes ------------------------------------------------------------------*/
45 | #include "stm32f3xx_hal_def.h"
46 |
47 | /** @addtogroup STM32F3xx_HAL_Driver
48 | * @{
49 | */
50 |
51 | /** @addtogroup CRCEx CRCEx
52 | * @{
53 | */
54 |
55 | /* Exported types ------------------------------------------------------------*/
56 | /* Exported constants --------------------------------------------------------*/
57 | /** @defgroup CRCEx_Exported_Constants CRC Extended Exported Constants
58 | * @{
59 | */
60 |
61 | /** @defgroup CRCEx_Input_Data_Inversion CRC Extended Input Data Inversion Modes
62 | * @{
63 | */
64 | #define CRC_INPUTDATA_INVERSION_NONE (0x00000000U) /*!< No input data inversion */
65 | #define CRC_INPUTDATA_INVERSION_BYTE ((uint32_t)CRC_CR_REV_IN_0) /*!< Byte-wise input data inversion */
66 | #define CRC_INPUTDATA_INVERSION_HALFWORD ((uint32_t)CRC_CR_REV_IN_1) /*!< HalfWord-wise input data inversion */
67 | #define CRC_INPUTDATA_INVERSION_WORD ((uint32_t)CRC_CR_REV_IN) /*!< Word-wise input data inversion */
68 | /**
69 | * @}
70 | */
71 |
72 | /** @defgroup CRCEx_Output_Data_Inversion CRC Extended Output Data Inversion Modes
73 | * @{
74 | */
75 | #define CRC_OUTPUTDATA_INVERSION_DISABLE (0x00000000U) /*!< No output data inversion */
76 | #define CRC_OUTPUTDATA_INVERSION_ENABLE ((uint32_t)CRC_CR_REV_OUT) /*!< Bit-wise output data inversion */
77 | /**
78 | * @}
79 | */
80 |
81 | /**
82 | * @}
83 | */
84 |
85 | /* Exported macro ------------------------------------------------------------*/
86 |
87 | /** @defgroup CRCEx_Exported_Macros CRC Extended Exported Macros
88 | * @{
89 | */
90 |
91 | /**
92 | * @brief Set CRC output reversal
93 | * @param __HANDLE__ CRC handle
94 | * @retval None.
95 | */
96 | #define __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT)
97 |
98 | /**
99 | * @brief Unset CRC output reversal
100 | * @param __HANDLE__ CRC handle
101 | * @retval None.
102 | */
103 | #define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT))
104 |
105 | /**
106 | * @brief Set CRC non-default polynomial
107 | * @param __HANDLE__ CRC handle
108 | * @param __POLYNOMIAL__ 7, 8, 16 or 32-bit polynomial
109 | * @retval None.
110 | */
111 | #define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__))
112 |
113 | /**
114 | * @}
115 | */
116 |
117 | /* Private macros --------------------------------------------------------*/
118 | /** @addtogroup CRCEx_Private_Macros CRCEx Private Macros
119 | * @{
120 | */
121 |
122 | #define IS_CRC_INPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_INPUTDATA_INVERSION_NONE) || \
123 | ((MODE) == CRC_INPUTDATA_INVERSION_BYTE) || \
124 | ((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \
125 | ((MODE) == CRC_INPUTDATA_INVERSION_WORD))
126 |
127 |
128 | #define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \
129 | ((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLE))
130 |
131 | /**
132 | * @}
133 | */
134 |
135 | /* Exported functions --------------------------------------------------------*/
136 | /** @addtogroup CRCEx_Exported_Functions CRC Extended Exported Functions
137 | * @{
138 | */
139 |
140 | /** @addtogroup CRCEx_Exported_Functions_Group1 CRC Extended Initialization and de-initialization functions
141 | * @brief Extended Initialization and Configuration functions.
142 | * @{
143 | */
144 | /* Initialization and de-initialization functions ****************************/
145 | HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength);
146 | HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode);
147 | HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode);
148 | /**
149 | * @}
150 | */
151 |
152 | /* Peripheral Control functions ***********************************************/
153 | /* Peripheral State and Error functions ***************************************/
154 |
155 | /**
156 | * @}
157 | */
158 |
159 | /**
160 | * @}
161 | */
162 |
163 | /**
164 | * @}
165 | */
166 |
167 | #ifdef __cplusplus
168 | }
169 | #endif
170 |
171 | #endif /* __STM32F3xx_HAL_CRC_EX_H */
172 |
173 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
174 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Inc/stm32f3xx_hal_opamp_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_hal_opamp_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of OPAMP HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2016 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 |
36 | /* Define to prevent recursive inclusion -------------------------------------*/
37 | #ifndef __STM32F3xx_HAL_OPAMP_EX_H
38 | #define __STM32F3xx_HAL_OPAMP_EX_H
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
45 | defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
46 | defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
47 | defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
48 |
49 | /* Includes ------------------------------------------------------------------*/
50 | #include "stm32f3xx_hal_def.h"
51 |
52 | /** @addtogroup STM32F3xx_HAL_Driver
53 | * @{
54 | */
55 |
56 | /** @addtogroup OPAMPEx OPAMPEx
57 | * @{
58 | */
59 | /* Exported types ------------------------------------------------------------*/
60 | /* Exported constants --------------------------------------------------------*/
61 | /* Exported macro ------------------------------------------------------------*/
62 | /* Exported functions --------------------------------------------------------*/
63 | /** @addtogroup OPAMPEx_Exported_Functions OPAMP Extended Exported Functions
64 | * @{
65 | */
66 |
67 | /** @addtogroup OPAMPEx_Exported_Functions_Group1 Extended Input and Output operation functions
68 | * @{
69 | */
70 |
71 | /* I/O operation functions *****************************************************/
72 |
73 | #if defined(STM32F302xE) || \
74 | defined(STM32F302xC)
75 |
76 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2);
77 |
78 | #endif /* STM32F302xE || */
79 | /* STM32F302xC */
80 |
81 | #if defined(STM32F303xE) || defined(STM32F398xx) || \
82 | defined(STM32F303xC) || defined(STM32F358xx)
83 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2, OPAMP_HandleTypeDef *hopamp3, OPAMP_HandleTypeDef *hopamp4);
84 | #endif /* STM32F303xE || STM32F398xx || */
85 | /* STM32F303xC || STM32F358xx */
86 |
87 | /**
88 | * @}
89 | */
90 |
91 | /**
92 | * @}
93 | */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
104 | /* STM32F302xC || STM32F303xC || STM32F358xx || */
105 | /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
106 | /* STM32F301x8 || STM32F302x8 || STM32F318xx */
107 |
108 | #ifdef __cplusplus
109 | }
110 | #endif
111 |
112 |
113 | #endif /* __STM32F3xx_HAL_OPAMP_EX_H */
114 |
115 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
116 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Inc/stm32f3xx_hal_pcd_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_hal_pcd_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of PCD HAL Extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2016 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 |
36 | /* Define to prevent recursive inclusion -------------------------------------*/
37 | #ifndef __STM32F3xx_HAL_PCD_EX_H
38 | #define __STM32F3xx_HAL_PCD_EX_H
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | #if defined(STM32F302xE) || defined(STM32F303xE) || \
45 | defined(STM32F302xC) || defined(STM32F303xC) || \
46 | defined(STM32F302x8) || \
47 | defined(STM32F373xC)
48 |
49 | /* Includes ------------------------------------------------------------------*/
50 | #include "stm32f3xx_hal_def.h"
51 |
52 | /** @addtogroup STM32F3xx_HAL_Driver
53 | * @{
54 | */
55 |
56 | /** @addtogroup PCDEx
57 | * @{
58 | */
59 |
60 | /* Exported types ------------------------------------------------------------*/
61 | /* Exported constants --------------------------------------------------------*/
62 | /* Exported macros -----------------------------------------------------------*/
63 | /** @defgroup PCDEx_Exported_Macros PCD Extended Exported Macros
64 | * @{
65 | */
66 | /**
67 | * @brief Gets address in an endpoint register.
68 | * @param USBx USB peripheral instance register address.
69 | * @param bEpNum Endpoint Number.
70 | * @retval None
71 | */
72 |
73 | #if defined(STM32F302xC) || defined(STM32F303xC) || \
74 | defined(STM32F373xC)
75 |
76 | #define PCD_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8)*2+ ((uint32_t)(USBx) + 0x400U)))))
77 | #define PCD_EP_TX_CNT(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+2)*2+ ((uint32_t)(USBx) + 0x400U)))))
78 | #define PCD_EP_RX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+4)*2+ ((uint32_t)(USBx) + 0x400U)))))
79 | #define PCD_EP_RX_CNT(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+6)*2+ ((uint32_t)(USBx) + 0x400U)))))
80 |
81 |
82 | #define PCD_SET_EP_RX_CNT(USBx, bEpNum,wCount) {\
83 | uint16_t *pdwReg =PCD_EP_RX_CNT((USBx),(bEpNum)); \
84 | PCD_SET_EP_CNT_RX_REG((pdwReg), (wCount))\
85 | }
86 |
87 | #endif /* STM32F302xC || STM32F303xC || */
88 | /* STM32F373xC */
89 |
90 |
91 | #if defined(STM32F302xE) || defined(STM32F303xE) || \
92 | defined(STM32F302x8)
93 |
94 | #define PCD_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8)+ ((uint32_t)(USBx) + 0x400U)))))
95 | #define PCD_EP_TX_CNT(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+2)+ ((uint32_t)(USBx) + 0x400U)))))
96 | #define PCD_EP_RX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+4)+ ((uint32_t)(USBx) + 0x400U)))))
97 | #define PCD_EP_RX_CNT(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8+6)+ ((uint32_t)(USBx) + 0x400U)))))
98 |
99 | #define PCD_SET_EP_RX_CNT(USBx, bEpNum,wCount) {\
100 | uint16_t *pdwReg = PCD_EP_RX_CNT((USBx), (bEpNum));\
101 | PCD_SET_EP_CNT_RX_REG((pdwReg), (wCount))\
102 | }
103 |
104 | #endif /* STM32F302xE || STM32F303xE || */
105 | /* STM32F302x8 */
106 | /**
107 | * @}
108 | */
109 |
110 | /* Exported functions --------------------------------------------------------*/
111 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions
112 | * @{
113 | */
114 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
115 | * @{
116 | */
117 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
118 | uint16_t ep_addr,
119 | uint16_t ep_kind,
120 | uint32_t pmaadress);
121 |
122 | void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
123 |
124 | /**
125 | * @}
126 | */
127 |
128 | /**
129 | * @}
130 | */
131 |
132 | /**
133 | * @}
134 | */
135 |
136 | /**
137 | * @}
138 | */
139 |
140 | #endif /* STM32F302xE || STM32F303xE || */
141 | /* STM32F302xC || STM32F303xC || */
142 | /* STM32F302x8 || */
143 | /* STM32F373xC */
144 |
145 | #ifdef __cplusplus
146 | }
147 | #endif
148 |
149 |
150 | #endif /* __STM32F3xx_HAL_PCD_EX_H */
151 |
152 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
153 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Inc/stm32f3xx_hal_spi_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_hal_spi_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of SPI HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2016 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 |
36 | /* Define to prevent recursive inclusion -------------------------------------*/
37 | #ifndef __STM32F3xx_HAL_SPI_EX_H
38 | #define __STM32F3xx_HAL_SPI_EX_H
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | /* Includes ------------------------------------------------------------------*/
45 | #include "stm32f3xx_hal_def.h"
46 |
47 | /** @addtogroup STM32F3xx_HAL_Driver
48 | * @{
49 | */
50 |
51 | /** @addtogroup SPIEx
52 | * @{
53 | */
54 |
55 | /* Exported types ------------------------------------------------------------*/
56 | /* Exported constants --------------------------------------------------------*/
57 | /* Exported macros -----------------------------------------------------------*/
58 | /* Exported functions --------------------------------------------------------*/
59 | /** @addtogroup SPIEx_Exported_Functions
60 | * @{
61 | */
62 |
63 | /* Initialization and de-initialization functions ****************************/
64 | /* IO operation functions *****************************************************/
65 | /** @addtogroup SPIEx_Exported_Functions_Group1
66 | * @{
67 | */
68 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi);
69 | /**
70 | * @}
71 | */
72 |
73 | /**
74 | * @}
75 | */
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | /**
82 | * @}
83 | */
84 |
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 |
89 | #endif /* __STM32F3xx_HAL_SPI_EX_H */
90 |
91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
92 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/STM32F303xC_User_Manual.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/HAL_Driver/STM32F303xC_User_Manual.chm
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/STM32F334x8_User_Manual.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/HAL_Driver/STM32F334x8_User_Manual.chm
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/STM32F373xC_User_Manual.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/HAL_Driver/STM32F373xC_User_Manual.chm
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Src/stm32f3xx_hal_msp_template.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_hal_msp_template.c
4 | * @author MCD Application Team
5 | * @brief HAL MSP module.
6 | * This file template is located in the HAL folder and should be copied
7 | * to the user folder.
8 | *
9 | @verbatim
10 | ===============================================================================
11 | ##### How to use this driver #####
12 | ===============================================================================
13 | [..]
14 |
15 | @endverbatim
16 | ******************************************************************************
17 | * @attention
18 | *
19 | * © COPYRIGHT(c) 2016 STMicroelectronics
20 | *
21 | * Redistribution and use in source and binary forms, with or without modification,
22 | * are permitted provided that the following conditions are met:
23 | * 1. Redistributions of source code must retain the above copyright notice,
24 | * this list of conditions and the following disclaimer.
25 | * 2. Redistributions in binary form must reproduce the above copyright notice,
26 | * this list of conditions and the following disclaimer in the documentation
27 | * and/or other materials provided with the distribution.
28 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
29 | * may be used to endorse or promote products derived from this software
30 | * without specific prior written permission.
31 | *
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
36 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
38 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
39 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
40 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 | *
43 | ******************************************************************************
44 | */
45 |
46 | /* Includes ------------------------------------------------------------------*/
47 | #include "stm32f3xx_hal.h"
48 |
49 | /** @addtogroup STM32F3xx_HAL_Driver
50 | * @{
51 | */
52 |
53 | /** @defgroup HAL_MSP HAL MSP module
54 | * @brief HAL MSP module.
55 | * @{
56 | */
57 |
58 | /* Private typedef -----------------------------------------------------------*/
59 | /* Private define ------------------------------------------------------------*/
60 | /* Private macro -------------------------------------------------------------*/
61 | /* Private variables ---------------------------------------------------------*/
62 | /* Private function prototypes -----------------------------------------------*/
63 | /* Exported functions ---------------------------------------------------------*/
64 |
65 | /** @defgroup HAL_MSP_Exported_Functions HAL MSP Exported Functions
66 | * @{
67 | */
68 |
69 | /**
70 | * @brief Initializes the Global MSP.
71 | * @retval None
72 | */
73 |
74 |
75 | /**
76 | * @brief DeInitializes the Global MSP.
77 | * @retval None
78 | */
79 | void HAL_MspDeInit(void)
80 | {
81 |
82 | }
83 |
84 | /**
85 | * @brief Initializes the PPP MSP.
86 | * @retval None
87 | */
88 | void HAL_PPP_MspInit(void)
89 | {
90 |
91 | }
92 |
93 | /**
94 | * @brief DeInitializes the PPP MSP.
95 | * @retval None
96 | */
97 | void HAL_PPP_MspDeInit(void)
98 | {
99 |
100 | }
101 |
102 | /**
103 | * @}
104 | */
105 |
106 | /**
107 | * @}
108 | */
109 |
110 | /**
111 | * @}
112 | */
113 |
114 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
115 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Src/stm32f3xx_hal_spi_ex.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_hal_spi_ex.c
4 | * @author MCD Application Team
5 | * @brief Extended SPI HAL module driver.
6 | * This file provides firmware functions to manage the following
7 | * SPI peripheral extended functionalities :
8 | * + IO operation functions
9 | *
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * © COPYRIGHT(c) 2016 STMicroelectronics
14 | *
15 | * Redistribution and use in source and binary forms, with or without modification,
16 | * are permitted provided that the following conditions are met:
17 | * 1. Redistributions of source code must retain the above copyright notice,
18 | * this list of conditions and the following disclaimer.
19 | * 2. Redistributions in binary form must reproduce the above copyright notice,
20 | * this list of conditions and the following disclaimer in the documentation
21 | * and/or other materials provided with the distribution.
22 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
23 | * may be used to endorse or promote products derived from this software
24 | * without specific prior written permission.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 | *
37 | ******************************************************************************
38 | */
39 |
40 | /* Includes ------------------------------------------------------------------*/
41 | #include "stm32f3xx_hal.h"
42 |
43 | /** @addtogroup STM32F3xx_HAL_Driver
44 | * @{
45 | */
46 |
47 | /** @defgroup SPIEx SPIEx
48 | * @brief SPI Extended HAL module driver
49 | * @{
50 | */
51 | #ifdef HAL_SPI_MODULE_ENABLED
52 |
53 | /* Private typedef -----------------------------------------------------------*/
54 | /* Private defines -----------------------------------------------------------*/
55 | /** @defgroup SPIEx_Private_Constants SPIEx Private Constants
56 | * @{
57 | */
58 | #define SPI_FIFO_SIZE 4
59 | /**
60 | * @}
61 | */
62 |
63 | /* Private macros ------------------------------------------------------------*/
64 | /* Private variables ---------------------------------------------------------*/
65 | /* Private function prototypes -----------------------------------------------*/
66 | /* Exported functions ---------------------------------------------------------*/
67 |
68 | /** @defgroup SPIEx_Exported_Functions SPIEx Exported Functions
69 | * @{
70 | */
71 |
72 | /** @defgroup SPIEx_Exported_Functions_Group1 IO operation functions
73 | * @brief Data transfers functions
74 | *
75 | @verbatim
76 | ==============================================================================
77 | ##### IO operation functions #####
78 | ===============================================================================
79 | [..]
80 | This subsection provides a set of extended functions to manage the SPI
81 | data transfers.
82 |
83 | (#) Rx data flush function:
84 | (++) HAL_SPIEx_FlushRxFifo()
85 |
86 | @endverbatim
87 | * @{
88 | */
89 |
90 | /**
91 | * @brief Flush the RX fifo.
92 | * @param hspi pointer to a SPI_HandleTypeDef structure that contains
93 | * the configuration information for the specified SPI module.
94 | * @retval HAL status
95 | */
96 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi)
97 | {
98 | __IO uint32_t tmpreg;
99 | uint8_t count = 0U;
100 | while ((hspi->Instance->SR & SPI_FLAG_FRLVL) != SPI_FRLVL_EMPTY)
101 | {
102 | count++;
103 | tmpreg = hspi->Instance->DR;
104 | UNUSED(tmpreg); /* To avoid GCC warning */
105 | if (count == SPI_FIFO_SIZE)
106 | {
107 | return HAL_TIMEOUT;
108 | }
109 | }
110 | return HAL_OK;
111 | }
112 |
113 | /**
114 | * @}
115 | */
116 |
117 | /**
118 | * @}
119 | */
120 |
121 | #endif /* HAL_SPI_MODULE_ENABLED */
122 |
123 | /**
124 | * @}
125 | */
126 |
127 | /**
128 | * @}
129 | */
130 |
131 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
132 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_alarm_template.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_alarm_template.c
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_wakeup_template.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_wakeup_template.c
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Src/stm32f3xx_ll_crc.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_ll_crc.c
4 | * @author MCD Application Team
5 | * @brief CRC LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2016 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 | #if defined(USE_FULL_LL_DRIVER)
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f3xx_ll_crc.h"
39 |
40 | #ifdef USE_FULL_ASSERT
41 | #include "stm32_assert.h"
42 | #else
43 | #define assert_param(expr) ((void)0U)
44 | #endif
45 |
46 | /** @addtogroup STM32F3xx_LL_Driver
47 | * @{
48 | */
49 |
50 | #if defined (CRC)
51 |
52 | /** @addtogroup CRC_LL
53 | * @{
54 | */
55 |
56 | /* Private types -------------------------------------------------------------*/
57 | /* Private variables ---------------------------------------------------------*/
58 | /* Private constants ---------------------------------------------------------*/
59 | /* Private macros ------------------------------------------------------------*/
60 | /* Private function prototypes -----------------------------------------------*/
61 |
62 | /* Exported functions --------------------------------------------------------*/
63 | /** @addtogroup CRC_LL_Exported_Functions
64 | * @{
65 | */
66 |
67 | /** @addtogroup CRC_LL_EF_Init
68 | * @{
69 | */
70 |
71 | /**
72 | * @brief De-initialize CRC registers (Registers restored to their default values).
73 | * @param CRCx CRC Instance
74 | * @retval An ErrorStatus enumeration value:
75 | * - SUCCESS: CRC registers are de-initialized
76 | * - ERROR: CRC registers are not de-initialized
77 | */
78 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx)
79 | {
80 | ErrorStatus status = SUCCESS;
81 |
82 | /* Check the parameters */
83 | assert_param(IS_CRC_ALL_INSTANCE(CRCx));
84 |
85 | if (CRCx == CRC)
86 | {
87 | /* Set programmable polynomial size in CR register to reset value (32 bits)*/
88 | LL_CRC_SetPolynomialSize(CRCx, LL_CRC_POLYLENGTH_32B);
89 |
90 | /* Set programmable polynomial in POL register to reset value */
91 | LL_CRC_SetPolynomialCoef(CRCx, LL_CRC_DEFAULT_CRC32_POLY);
92 |
93 | /* Set INIT register to reset value */
94 | LL_CRC_SetInitialData(CRCx, LL_CRC_DEFAULT_CRC_INITVALUE);
95 |
96 | /* Set Reversibility options on I/O data values in CR register to reset value */
97 | LL_CRC_SetInputDataReverseMode(CRCx, LL_CRC_INDATA_REVERSE_NONE);
98 | LL_CRC_SetOutputDataReverseMode(CRCx, LL_CRC_OUTDATA_REVERSE_NONE);
99 |
100 | /* Reset the CRC calculation unit */
101 | LL_CRC_ResetCRCCalculationUnit(CRCx);
102 |
103 | /* Reset IDR register */
104 | LL_CRC_Write_IDR(CRCx, 0x00U);
105 | }
106 | else
107 | {
108 | status = ERROR;
109 | }
110 |
111 | return (status);
112 | }
113 |
114 | /**
115 | * @}
116 | */
117 |
118 | /**
119 | * @}
120 | */
121 |
122 | /**
123 | * @}
124 | */
125 |
126 | #endif /* defined (CRC) */
127 |
128 | /**
129 | * @}
130 | */
131 |
132 | #endif /* USE_FULL_LL_DRIVER */
133 |
134 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
135 |
136 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Src/stm32f3xx_ll_hrtim.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_ll_hrtim.c
4 | * @author MCD Application Team
5 | * @brief HRTIM LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2016 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 | #if defined(USE_FULL_LL_DRIVER)
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f3xx_ll_hrtim.h"
39 | #include "stm32f3xx_ll_bus.h"
40 |
41 | #ifdef USE_FULL_ASSERT
42 | #include "stm32_assert.h"
43 | #else
44 | #define assert_param(expr) ((void)0U)
45 | #endif
46 |
47 | /** @addtogroup STM32F3xx_LL_Driver
48 | * @{
49 | */
50 |
51 | #if defined (HRTIM1)
52 |
53 | /** @addtogroup HRTIM_LL
54 | * @{
55 | */
56 |
57 | /* Private types -------------------------------------------------------------*/
58 | /* Private variables ---------------------------------------------------------*/
59 | /* Private constants ---------------------------------------------------------*/
60 | /* Private macros ------------------------------------------------------------*/
61 | /* Private function prototypes -----------------------------------------------*/
62 | /* Exported functions --------------------------------------------------------*/
63 | /** @addtogroup HRTIM_LL_Exported_Functions
64 | * @{
65 | */
66 | /**
67 | * @brief Set HRTIM instance registers to their reset values.
68 | * @param HRTIMx High Resolution Timer instance
69 | * @retval ErrorStatus enumeration value:
70 | * - SUCCESS: HRTIMx registers are de-initialized
71 | * - ERROR: invalid HRTIMx instance
72 | */
73 | ErrorStatus LL_HRTIM_DeInit(HRTIM_TypeDef* HRTIMx)
74 | {
75 | ErrorStatus result = SUCCESS;
76 |
77 | /* Check the parameters */
78 | assert_param(IS_HRTIM_ALL_INSTANCE(HRTIMx));
79 |
80 | LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_HRTIM1);
81 | LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_HRTIM1);
82 |
83 | return result;
84 | }
85 | /**
86 | * @}
87 | */
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | #endif /* HRTIM1 */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | #endif /* USE_FULL_LL_DRIVER */
100 |
101 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
102 |
--------------------------------------------------------------------------------
/Free-template/HAL_Driver/Src/stm32f3xx_ll_pwr.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f3xx_ll_pwr.c
4 | * @author MCD Application Team
5 | * @brief PWR LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2016 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 | #if defined(USE_FULL_LL_DRIVER)
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f3xx_ll_pwr.h"
39 | #include "stm32f3xx_ll_bus.h"
40 |
41 | /** @addtogroup STM32F3xx_LL_Driver
42 | * @{
43 | */
44 |
45 | #if defined(PWR)
46 |
47 | /** @defgroup PWR_LL PWR
48 | * @{
49 | */
50 |
51 | /* Private types -------------------------------------------------------------*/
52 | /* Private variables ---------------------------------------------------------*/
53 | /* Private constants ---------------------------------------------------------*/
54 | /* Private macros ------------------------------------------------------------*/
55 | /* Private function prototypes -----------------------------------------------*/
56 |
57 | /* Exported functions --------------------------------------------------------*/
58 | /** @addtogroup PWR_LL_Exported_Functions
59 | * @{
60 | */
61 |
62 | /** @addtogroup PWR_LL_EF_Init
63 | * @{
64 | */
65 |
66 | /**
67 | * @brief De-initialize the PWR registers to their default reset values.
68 | * @retval An ErrorStatus enumeration value:
69 | * - SUCCESS: PWR registers are de-initialized
70 | * - ERROR: not applicable
71 | */
72 | ErrorStatus LL_PWR_DeInit(void)
73 | {
74 | /* Force reset of PWR clock */
75 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_PWR);
76 |
77 | /* Release reset of PWR clock */
78 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_PWR);
79 |
80 | return SUCCESS;
81 | }
82 |
83 | /**
84 | * @}
85 | */
86 |
87 | /**
88 | * @}
89 | */
90 |
91 | /**
92 | * @}
93 | */
94 | #endif /* defined(PWR) */
95 | /**
96 | * @}
97 | */
98 |
99 | #endif /* USE_FULL_LL_DRIVER */
100 |
101 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
102 |
--------------------------------------------------------------------------------
/Free-template/LED_button_Task Debug (1).cfg:
--------------------------------------------------------------------------------
1 | # This is an NUCLEO-F303RE board with a single STM32F303RETx chip
2 | #
3 | # Generated by System Workbench for STM32
4 | # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
5 |
6 | source [find interface/stlink.cfg]
7 |
8 | set WORKAREASIZE 0x8000
9 |
10 | transport select "hla_swd"
11 |
12 | set CHIPNAME STM32F303RETx
13 | set BOARDNAME NUCLEO-F303RE
14 |
15 | # CHIPNAMES state
16 | set CHIPNAME_CPU0_ACTIVATED 1
17 |
18 | # Enable debug when in low power modes
19 | set ENABLE_LOW_POWER 1
20 |
21 | # Stop Watchdog counters when halt
22 | set STOP_WATCHDOG 1
23 |
24 | # STlink Debug clock frequency
25 | set CLOCK_FREQ 8000
26 |
27 | # use hardware reset, connect under reset
28 | # connect_assert_srst needed if low power mode application running (WFI...)
29 | reset_config srst_only srst_nogate connect_assert_srst
30 | set CONNECT_UNDER_RESET 1
31 |
32 | # BCTM CPU variables
33 |
34 |
35 |
36 | source [find target/stm32f3x.cfg]
37 |
--------------------------------------------------------------------------------
/Free-template/LED_button_Task Debug.cfg:
--------------------------------------------------------------------------------
1 | # This is an NUCLEO-F303RE board with a single STM32F303RETx chip
2 | #
3 | # Generated by System Workbench for STM32
4 | # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
5 |
6 | source [find interface/stlink.cfg]
7 |
8 | set WORKAREASIZE 0x8000
9 |
10 | transport select "hla_swd"
11 |
12 | set CHIPNAME STM32F303RETx
13 | set BOARDNAME NUCLEO-F303RE
14 |
15 | # CHIPNAMES state
16 | set CHIPNAME_CPU0_ACTIVATED 1
17 |
18 | # Enable debug when in low power modes
19 | set ENABLE_LOW_POWER 1
20 |
21 | # Stop Watchdog counters when halt
22 | set STOP_WATCHDOG 1
23 |
24 | # STlink Debug clock frequency
25 | set CLOCK_FREQ 8000
26 |
27 | # use hardware reset, connect under reset
28 | # connect_assert_srst needed if low power mode application running (WFI...)
29 | reset_config srst_only srst_nogate connect_assert_srst
30 | set CONNECT_UNDER_RESET 1
31 |
32 | # BCTM CPU variables
33 |
34 |
35 |
36 | source [find target/stm32f3x.cfg]
37 |
--------------------------------------------------------------------------------
/Free-template/LinkerScript.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/LinkerScript.ld
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/FreeRTOS/org/Source/include/StackMacros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.4.3
3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * https://www.FreeRTOS.org
23 | * https://github.com/FreeRTOS
24 | *
25 | */
26 |
27 |
28 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */
29 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released.
30 | #endif
31 |
32 | #include "stack_macros.h"
33 |
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/FreeRTOS/org/Source/include/projdefs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.4.3
3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * https://www.FreeRTOS.org
23 | * https://github.com/FreeRTOS
24 | *
25 | */
26 |
27 | #ifndef PROJDEFS_H
28 | #define PROJDEFS_H
29 |
30 | /*
31 | * Defines the prototype to which task functions must conform. Defined in this
32 | * file to ensure the type is known before portable.h is included.
33 | */
34 | typedef void (* TaskFunction_t)( void * );
35 |
36 | /* Converts a time in milliseconds to a time in ticks. This macro can be
37 | * overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
38 | * definition here is not suitable for your application. */
39 | #ifndef pdMS_TO_TICKS
40 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000U ) )
41 | #endif
42 |
43 | #define pdFALSE ( ( BaseType_t ) 0 )
44 | #define pdTRUE ( ( BaseType_t ) 1 )
45 |
46 | #define pdPASS ( pdTRUE )
47 | #define pdFAIL ( pdFALSE )
48 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
49 | #define errQUEUE_FULL ( ( BaseType_t ) 0 )
50 |
51 | /* FreeRTOS error definitions. */
52 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
53 | #define errQUEUE_BLOCKED ( -4 )
54 | #define errQUEUE_YIELD ( -5 )
55 |
56 | /* Macros used for basic data corruption checks. */
57 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
58 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
59 | #endif
60 |
61 | #if ( configUSE_16_BIT_TICKS == 1 )
62 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a
63 | #else
64 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
65 | #endif
66 |
67 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS
68 | * itself. */
69 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */
70 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
71 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
72 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
73 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
74 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
75 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
76 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
77 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
78 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
79 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
80 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
81 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
82 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
83 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
84 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
85 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
86 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
87 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
88 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
89 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
90 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
91 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
92 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
93 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
94 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
95 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
96 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
97 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
98 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
99 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
100 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
101 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
102 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
103 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
104 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
105 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
106 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
107 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
108 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
109 |
110 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS
111 | * itself. */
112 | #define pdFREERTOS_LITTLE_ENDIAN 0
113 | #define pdFREERTOS_BIG_ENDIAN 1
114 |
115 | /* Re-defining endian values for generic naming. */
116 | #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN
117 | #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN
118 |
119 |
120 | #endif /* PROJDEFS_H */
121 |
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/FreeRTOS/org/Source/include/stdint.readme:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.4.3
3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * https://www.FreeRTOS.org
23 | * https://github.com/FreeRTOS
24 | *
25 | */
26 |
27 | #ifndef FREERTOS_STDINT
28 | #define FREERTOS_STDINT
29 |
30 | /*******************************************************************************
31 | * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions
32 | * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be
33 | * built using compilers that do not provide their own stdint.h definition.
34 | *
35 | * To use this file:
36 | *
37 | * 1) Copy this file into the directory that contains your FreeRTOSConfig.h
38 | * header file, as that directory will already be in the compiler's include
39 | * path.
40 | *
41 | * 2) Rename the copied file stdint.h.
42 | *
43 | */
44 |
45 | typedef signed char int8_t;
46 | typedef unsigned char uint8_t;
47 | typedef short int16_t;
48 | typedef unsigned short uint16_t;
49 | typedef long int32_t;
50 | typedef unsigned long uint32_t;
51 |
52 | #endif /* FREERTOS_STDINT */
53 |
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/FreeRTOS/org/Source/portable/MemMang/ReadMe.url:
--------------------------------------------------------------------------------
1 | [{000214A0-0000-0000-C000-000000000046}]
2 | Prop3=19,2
3 | [InternetShortcut]
4 | URL=https://www.FreeRTOS.org/a00111.html
5 | IDList=
6 |
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/FreeRTOS/org/Source/readme.txt:
--------------------------------------------------------------------------------
1 | Each real time kernel port consists of three files that contain the core kernel
2 | components and are common to every port, and one or more files that are
3 | specific to a particular microcontroller and or compiler.
4 |
5 | + The FreeRTOS/Source directory contains the three files that are common to
6 | every port - list.c, queue.c and tasks.c. The kernel is contained within these
7 | three files. croutine.c implements the optional co-routine functionality - which
8 | is normally only used on very memory limited systems.
9 |
10 | + The FreeRTOS/Source/Portable directory contains the files that are specific to
11 | a particular microcontroller and or compiler.
12 |
13 | + The FreeRTOS/Source/include directory contains the real time kernel header
14 | files.
15 |
16 | See the readme file in the FreeRTOS/Source/Portable directory for more
17 | information.
18 |
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/FreeRTOS/org/Source/st_readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/Middlewares/Third_Party/FreeRTOS/org/Source/st_readme.txt
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/SEGGER/Config/Global.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * SEGGER Microcontroller GmbH *
3 | * The Embedded Experts *
4 | **********************************************************************
5 | * *
6 | * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 | * *
8 | * www.segger.com Support: support@segger.com *
9 | * *
10 | **********************************************************************
11 | * *
12 | * SEGGER SystemView * Real-time application analysis *
13 | * *
14 | **********************************************************************
15 | * *
16 | * All rights reserved. *
17 | * *
18 | * SEGGER strongly recommends to not make any changes *
19 | * to or modify the source code of this software in order to stay *
20 | * compatible with the SystemView and RTT protocol, and J-Link. *
21 | * *
22 | * Redistribution and use in source and binary forms, with or *
23 | * without modification, are permitted provided that the following *
24 | * condition is met: *
25 | * *
26 | * o Redistributions of source code must retain the above copyright *
27 | * notice, this condition and the following disclaimer. *
28 | * *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 | * DAMAGE. *
42 | * *
43 | **********************************************************************
44 | * *
45 | * SystemView version: 3.30 *
46 | * *
47 | **********************************************************************
48 | ----------------------------------------------------------------------
49 | File : Global.h
50 | Purpose : Global types
51 | In case your application already has a Global.h, you should
52 | merge the files. In order to use Segger code, the types
53 | U8, U16, U32, I8, I16, I32 need to be defined in Global.h;
54 | additional definitions do not hurt.
55 | Revision: $Rev: 12501 $
56 | ---------------------------END-OF-HEADER------------------------------
57 | */
58 |
59 | #ifndef GLOBAL_H // Guard against multiple inclusion
60 | #define GLOBAL_H
61 |
62 | #define U8 unsigned char
63 | #define I8 signed char
64 | #define U16 unsigned short
65 | #define I16 signed short
66 | #ifdef __x86_64__
67 | #define U32 unsigned
68 | #define I32 int
69 | #else
70 | #define U32 unsigned long
71 | #define I32 signed long
72 | #endif
73 |
74 | //
75 | // CC_NO_LONG_SUPPORT can be defined to compile test
76 | // without long support for compilers that do not
77 | // support C99 and its long type.
78 | //
79 | #ifdef CC_NO_LONG_SUPPORT
80 | #define PTR_ADDR U32
81 | #else // Supports long type.
82 | #if defined(_WIN32) && !defined(__clang__) && !defined(__MINGW32__)
83 | //
84 | // Microsoft VC6 compiler related
85 | //
86 | #define U64 unsigned __int64
87 | #define U128 unsigned __int128
88 | #define I64 __int64
89 | #define I128 __int128
90 | #if _MSC_VER <= 1200
91 | #define U64_C(x) x##UI64
92 | #else
93 | #define U64_C(x) x##ULL
94 | #endif
95 | #else
96 | //
97 | // C99 compliant compiler
98 | //
99 | #define U64 unsigned long long
100 | #define I64 signed long long
101 | #define U64_C(x) x##ULL
102 | #endif
103 |
104 | #if (defined(_WIN64) || defined(__LP64__)) // 64-bit symbols used by Visual Studio and GCC, maybe others as well.
105 | #define PTR_ADDR U64
106 | #else
107 | #define PTR_ADDR U32
108 | #endif
109 | #endif // Supports long type.
110 |
111 | #endif // Avoid multiple inclusion
112 |
113 | /*************************** End of file ****************************/
114 |
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/SEGGER/Config/SEGGER_SYSVIEW_Conf.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * SEGGER Microcontroller GmbH *
3 | * The Embedded Experts *
4 | **********************************************************************
5 | * *
6 | * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 | * *
8 | * www.segger.com Support: support@segger.com *
9 | * *
10 | **********************************************************************
11 | * *
12 | * SEGGER SystemView * Real-time application analysis *
13 | * *
14 | **********************************************************************
15 | * *
16 | * All rights reserved. *
17 | * *
18 | * SEGGER strongly recommends to not make any changes *
19 | * to or modify the source code of this software in order to stay *
20 | * compatible with the SystemView and RTT protocol, and J-Link. *
21 | * *
22 | * Redistribution and use in source and binary forms, with or *
23 | * without modification, are permitted provided that the following *
24 | * condition is met: *
25 | * *
26 | * o Redistributions of source code must retain the above copyright *
27 | * notice, this condition and the following disclaimer. *
28 | * *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 | * DAMAGE. *
42 | * *
43 | **********************************************************************
44 | * *
45 | * SystemView version: 3.30 *
46 | * *
47 | **********************************************************************
48 | -------------------------- END-OF-HEADER -----------------------------
49 |
50 | File : SEGGER_SYSVIEW_Conf.h
51 | Purpose : SEGGER SystemView configuration file.
52 | Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
53 | Revision: $Rev: 21292 $
54 |
55 | Additional information:
56 | Required defines which must be set are:
57 | SEGGER_SYSVIEW_GET_TIMESTAMP
58 | SEGGER_SYSVIEW_GET_INTERRUPT_ID
59 | For known compilers and cores, these might be set to good defaults
60 | in SEGGER_SYSVIEW_ConfDefaults.h.
61 |
62 | SystemView needs a (nestable) locking mechanism.
63 | If not defined, the RTT locking mechanism is used,
64 | which then needs to be properly configured.
65 | */
66 |
67 | #ifndef SEGGER_SYSVIEW_CONF_H
68 | #define SEGGER_SYSVIEW_CONF_H
69 |
70 | /*********************************************************************
71 | *
72 | * Defines, configurable
73 | *
74 | **********************************************************************
75 | */
76 |
77 | /*********************************************************************
78 | * TODO: Add your defines here. *
79 | **********************************************************************
80 | */
81 |
82 | // Use internal recorder
83 | #define SEGGER_SYSVIEW_USE_INTERNAL_RECORDER 1
84 |
85 | #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
86 | #define SEGGER_SYSVIEW_RTT_BUFFER_SIZE (1024*8)
87 |
88 |
89 | #endif // SEGGER_SYSVIEW_CONF_H
90 |
91 | /*************************** End of file ****************************/
92 |
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/SEGGER/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * SEGGER Microcontroller GmbH *
3 | * The Embedded Experts *
4 | **********************************************************************
5 | * *
6 | * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 | * *
8 | * www.segger.com Support: support@segger.com *
9 | * *
10 | **********************************************************************
11 | * *
12 | * SEGGER SystemView * Real-time application analysis *
13 | * *
14 | **********************************************************************
15 | * *
16 | * All rights reserved. *
17 | * *
18 | * SEGGER strongly recommends to not make any changes *
19 | * to or modify the source code of this software in order to stay *
20 | * compatible with the SystemView and RTT protocol, and J-Link. *
21 | * *
22 | * Redistribution and use in source and binary forms, with or *
23 | * without modification, are permitted provided that the following *
24 | * condition is met: *
25 | * *
26 | * o Redistributions of source code must retain the above copyright *
27 | * notice, this condition and the following disclaimer. *
28 | * *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 | * DAMAGE. *
42 | * *
43 | **********************************************************************
44 | * *
45 | * SystemView version: 3.30 *
46 | * *
47 | **********************************************************************
48 | -------------------------- END-OF-HEADER -----------------------------
49 |
50 | File : SEGGER_SYSVIEW_Config_FreeRTOS.c
51 | Purpose : Sample setup configuration of SystemView with FreeRTOS.
52 | Revision: $Rev: 7745 $
53 | */
54 | #include "FreeRTOS.h"
55 | #include "SEGGER_SYSVIEW.h"
56 |
57 | extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
58 |
59 | /*********************************************************************
60 | *
61 | * Defines, configurable
62 | *
63 | **********************************************************************
64 | */
65 | // The application name to be displayed in SystemViewer
66 | #define SYSVIEW_APP_NAME "Hello APP"
67 |
68 | // The target device name
69 | #define SYSVIEW_DEVICE_NAME "NECLEO-F303RE"
70 |
71 | // Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
72 | #define SYSVIEW_TIMESTAMP_FREQ (configCPU_CLOCK_HZ)
73 |
74 | // System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
75 | #define SYSVIEW_CPU_FREQ configCPU_CLOCK_HZ
76 |
77 | // The lowest RAM address used for IDs (pointers)
78 | #define SYSVIEW_RAM_BASE (0x10000000)
79 |
80 | #define DEMCR (*(volatile U32*) (0xE000EDFCuL))
81 | // Debug Exception and Monitor Control Register
82 | #define TRACEENA_BIT (1uL << 24) // Trace enable bit
83 | #define DWT_CTRL (*(volatile U32*) (0xE0001000uL)) // DWT Control Register
84 | #define NOCYCCNT_BIT (1uL << 25)
85 | // Cycle counter support bit
86 | #define CYCCNTENA_BIT (1uL << 0)
87 | // Cycle counter enable bit
88 | //
89 | // If events will be recorded without a debug probe (J-Link) attached,
90 | // enable the cycle counter
91 | //
92 | #define ENABLE_DWT_CYCCNT (SEGGER_SYSVIEW_POST_MORTEM_MODE || SEGGER_SYSVIEW_USE_INTERNAL_RECORDER)
93 |
94 | /*********************************************************************
95 | *
96 | * _cbSendSystemDesc()
97 | *
98 | * Function description
99 | * Sends SystemView description strings.
100 | */
101 | static void _cbSendSystemDesc(void) {
102 | SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=FreeRTOS");
103 | SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
104 | }
105 |
106 | /*********************************************************************
107 | *
108 | * Global functions
109 | *
110 | **********************************************************************
111 | */
112 | void SEGGER_SYSVIEW_Conf(void) {
113 |
114 | #if ENABLE_DWT_CYCCNT
115 | //
116 | // If no debugger is connected, the DWT must be enabled by the application
117 | //
118 | if ((DEMCR & TRACEENA_BIT) == 0)
119 | {
120 | DEMCR |= TRACEENA_BIT;
121 | }
122 | #endif
123 |
124 | //
125 | // The cycle counter must be activated in order
126 | // to use time related functions.
127 | //
128 | if ((DWT_CTRL & NOCYCCNT_BIT) == 0)
129 | {
130 | // Cycle counter supported?
131 | if ((DWT_CTRL & CYCCNTENA_BIT) == 0)
132 | {
133 | // Cycle counter not enabled?
134 | DWT_CTRL |= CYCCNTENA_BIT; // Enable Cycle counter
135 | }
136 | }
137 | SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
138 | &SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
139 | SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
140 | }
141 |
142 | /*************************** End of file ****************************/
143 |
--------------------------------------------------------------------------------
/Free-template/Middlewares/Third_Party/SEGGER/SEGGER/SEGGER_SYSVIEW_Int.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * SEGGER Microcontroller GmbH *
3 | * The Embedded Experts *
4 | **********************************************************************
5 | * *
6 | * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 | * *
8 | * www.segger.com Support: support@segger.com *
9 | * *
10 | **********************************************************************
11 | * *
12 | * SEGGER SystemView * Real-time application analysis *
13 | * *
14 | **********************************************************************
15 | * *
16 | * All rights reserved. *
17 | * *
18 | * SEGGER strongly recommends to not make any changes *
19 | * to or modify the source code of this software in order to stay *
20 | * compatible with the SystemView and RTT protocol, and J-Link. *
21 | * *
22 | * Redistribution and use in source and binary forms, with or *
23 | * without modification, are permitted provided that the following *
24 | * condition is met: *
25 | * *
26 | * o Redistributions of source code must retain the above copyright *
27 | * notice, this condition and the following disclaimer. *
28 | * *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 | * DAMAGE. *
42 | * *
43 | **********************************************************************
44 | * *
45 | * SystemView version: 3.30 *
46 | * *
47 | **********************************************************************
48 | -------------------------- END-OF-HEADER -----------------------------
49 | File : SEGGER_SYSVIEW_Int.h
50 | Purpose : SEGGER SystemView internal header.
51 | Revision: $Rev: 21281 $
52 | */
53 |
54 | #ifndef SEGGER_SYSVIEW_INT_H
55 | #define SEGGER_SYSVIEW_INT_H
56 |
57 | /*********************************************************************
58 | *
59 | * #include Section
60 | *
61 | **********************************************************************
62 | */
63 |
64 | #include "SEGGER_SYSVIEW.h"
65 |
66 | #ifdef __cplusplus
67 | extern "C" {
68 | #endif
69 |
70 |
71 | /*********************************************************************
72 | *
73 | * Private data types
74 | *
75 | **********************************************************************
76 | */
77 | //
78 | // Commands that Host can send to target
79 | //
80 | typedef enum {
81 | SEGGER_SYSVIEW_COMMAND_ID_START = 1,
82 | SEGGER_SYSVIEW_COMMAND_ID_STOP,
83 | SEGGER_SYSVIEW_COMMAND_ID_GET_SYSTIME,
84 | SEGGER_SYSVIEW_COMMAND_ID_GET_TASKLIST,
85 | SEGGER_SYSVIEW_COMMAND_ID_GET_SYSDESC,
86 | SEGGER_SYSVIEW_COMMAND_ID_GET_NUMMODULES,
87 | SEGGER_SYSVIEW_COMMAND_ID_GET_MODULEDESC,
88 | SEGGER_SYSVIEW_COMMAND_ID_HEARTBEAT = 127,
89 | // Extended commands: Commands >= 128 have a second parameter
90 | SEGGER_SYSVIEW_COMMAND_ID_GET_MODULE = 128
91 | } SEGGER_SYSVIEW_COMMAND_ID;
92 |
93 | #ifdef __cplusplus
94 | }
95 | #endif
96 |
97 | #endif
98 |
99 | /*************************** End of file ****************************/
100 |
--------------------------------------------------------------------------------
/Free-template/NUCLEO-F303RE.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ]>
11 |
12 |
13 |
14 | NUCLEO-F303RE
15 | JTAG
16 | SWD
17 | ST-Link
18 | stm32f303retx
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Free-template/README.md:
--------------------------------------------------------------------------------
1 | # FreeRTOS Template
2 |
3 | ## Functions
4 | 1. void USART_SendData(USART_TypeDef* USARTx, uint16_t Data).
5 | - Used to send data over UART peripheral.
6 |
7 | 2. uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG);
8 | - Used to check the flag to know the Status of some register
9 |
10 | 3. void USART2_init(void); //UART peripheral Initialization
11 | - Used to initalize the UART hardware
12 |
13 | 4. void GPIO_Init(); // Hardware to work with UART
14 | - GPIO(General purpose Input Output)
15 |
16 | 5. void Error_handler();
17 | - Infinte loop when error handle happens
18 |
19 | 6. void prm(char *msg);
20 | - Used to send strings over UART
21 |
22 | ## Include
23 | 1. #include "stm32f3xx.h"
24 | - Stm32f3 header file
25 | 2. #include "stm32f3xx_nucleo.h"
26 | - Header file for nucleo board
27 | 3. #include "FreeRTOS.h"
28 | - FreeRTOS header file
29 | 4. #include "SEGGER_SYSVIEW.h"
30 | - Will be explanid in the future but it used to watch the context switching between tasks
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Free-template/SEGGGER_Dump/001.SVdat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/SEGGGER_Dump/001.SVdat
--------------------------------------------------------------------------------
/Free-template/SEGGGER_Dump/002.SVdat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/SEGGGER_Dump/002.SVdat
--------------------------------------------------------------------------------
/Free-template/Utilities/STM32F3xx-Nucleo/STM32F3xx-Nucleo_BSP_User_Manual.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/Utilities/STM32F3xx-Nucleo/STM32F3xx-Nucleo_BSP_User_Manual.chm
--------------------------------------------------------------------------------
/Free-template/src/it.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx.h"
2 | #include "stm32f3xx_nucleo.h"
3 |
4 | extern USART_HandleTypeDef uart;
5 | void SysTick_Handler(void)
6 | {
7 | // HAL_IncTick();
8 | //HAL_SYSTICK_IRQHandler();
9 | }
10 | void USART2_IRQHandler(void)
11 | {
12 |
13 | HAL_UART_IRQHandler(&uart);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Free-template/src/main.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file main.c
4 | * @author Ac6
5 | * @version V1.0
6 | * @date 01-December-2013
7 | * @brief Default main function.
8 | ******************************************************************************
9 | */
10 |
11 | #include "stm32f3xx.h"
12 | #include "stm32f3xx_nucleo.h"
13 | #include "FreeRTOS.h"
14 | #include "task.h"
15 | #include "string.h"
16 | #include "SEGGER_SYSVIEW.h"
17 |
18 |
19 | //some macros
20 |
21 |
22 |
23 | //Task handles
24 | TaskHandle_t xTaskHandler1 = NULL;
25 | TaskHandle_t xTaskHandler2 = NULL;
26 | TaskFunction_t pxTaskCode;
27 |
28 | //Functions
29 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
30 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG);
31 | void USART2_init(void); //UART peripheral Initialization
32 | void GPIO_Init(); // Hardware to work with UART
33 | void Error_handler();
34 | void prm(char *msg);
35 |
36 |
37 |
38 | UART_HandleTypeDef uart;
39 | char user_data[250];
40 |
41 |
42 |
43 | int main(void) {
44 |
45 | DWT->CTRL |=(1<<0);
46 | //initialise_monitor_handles();
47 | HAL_Init();
48 | GPIO_Init();
49 | USART2_init();
50 |
51 |
52 | for (;;);
53 | }
54 |
55 |
56 | void USART2_init(void) {
57 |
58 | uart.Instance = USART2;
59 | uart.Init.BaudRate = 115200;
60 | uart.Init.Mode = USART_MODE_TX_RX;
61 | uart.Init.WordLength = UART_WORDLENGTH_8B;
62 | uart.Init.StopBits = USART_STOPBITS_1;
63 | uart.Init.Parity = USART_PARITY_NONE;
64 | uart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
65 | uart.Init.OverSampling = UART_OVERSAMPLING_16;
66 | while (HAL_UART_Init(&uart) != HAL_OK) {
67 | Error_handler();
68 | }
69 |
70 | }
71 |
72 | void GPIO_Init(){
73 |
74 | GPIO_InitTypeDef led_gpio,button_gpio;
75 | __HAL_RCC_GPIOA_CLK_ENABLE();
76 | __HAL_RCC_GPIOC_CLK_ENABLE();
77 | led_gpio.Mode=GPIO_MODE_OUTPUT_PP;
78 | led_gpio.Pin=GPIO_PIN_5;
79 | led_gpio.Speed=GPIO_SPEED_FREQ_MEDIUM;
80 | led_gpio.Pull=GPIO_NOPULL;
81 | HAL_GPIO_Init(GPIOA,&led_gpio);
82 |
83 | button_gpio.Mode=GPIO_MODE_INPUT;
84 | button_gpio.Pin=GPIO_PIN_13;
85 | button_gpio.Speed=GPIO_SPEED_FREQ_MEDIUM;
86 | button_gpio.Pull=GPIO_NOPULL;
87 | HAL_GPIO_Init(GPIOC,&button_gpio);
88 |
89 | }
90 | void Error_handler() {
91 |
92 | while (1)
93 | ;
94 | }
95 | void prm(char *msg) {
96 | uint16_t len = strlen(msg);
97 | //HAL_UART_Transmit(&uart, (uint8_t *) msg, len, HAL_MAX_DELAY);
98 | for(uint32_t i=0;iTDR = (Data & (uint16_t)0x01FF);
109 | }
110 |
111 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG)
112 | {
113 | uint8_t bitstatus = RESET;
114 |
115 | if ((USARTx->ISR & USART_FLAG) != (uint16_t)RESET)
116 | {
117 | bitstatus = SET;
118 | }
119 | else
120 | {
121 | bitstatus = RESET;
122 | }
123 | return bitstatus;
124 | }
125 |
--------------------------------------------------------------------------------
/Free-template/src/msp.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx_hal.h"
2 |
3 | void HAL_UART_MspInit(UART_HandleTypeDef *huart)
4 | {
5 | __HAL_RCC_USART2_CLK_ENABLE();
6 | __HAL_RCC_GPIOA_CLK_ENABLE();
7 |
8 | GPIO_InitTypeDef gpio_init;
9 | gpio_init.Pin = GPIO_PIN_2 | GPIO_PIN_3;
10 | gpio_init.Mode = GPIO_MODE_AF_PP;
11 | gpio_init.Pull = GPIO_NOPULL;
12 | gpio_init.Alternate = GPIO_AF7_USART2;
13 |
14 | HAL_GPIO_Init(GPIOA , &gpio_init);
15 |
16 | HAL_NVIC_EnableIRQ(USART2_IRQn);
17 |
18 | HAL_NVIC_SetPriority(USART2_IRQn, 15, 0);
19 | }
20 | void HAL_MspInit(void)
21 | {
22 | NVIC_SetPriorityGrouping( 0 );
23 | }
24 |
--------------------------------------------------------------------------------
/Free-template/src/syscalls.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Free-template/src/syscalls.c
--------------------------------------------------------------------------------
/LED_Button_Delete_Task/README.md:
--------------------------------------------------------------------------------
1 | # Delete Task
2 |
3 | ## In this part New Functions APIs we gonna use
4 |
5 | - void vTaskDelay( const TickType_t xTicksToDelay ) : Delay a task for a given number of ticks. The actual time that the task remains blocked depends on the tick rate.\
6 | __Parameters__
7 | - xTicksToDelay The amount of time, in tick periods, that the calling task should block.
8 |
9 | - void vTaskDelete( TaskHandle_t xTask ) : Remove a task from the RTOS kernels management. The task being deleted will be removed from all ready, blocked, suspended and event lists.
10 |
11 | __Parameters__
12 | - xTask The handle of the task to be deleted. Passing NULL will cause the calling task to be deleted.
13 |
14 |
15 | __Control flow__
16 |
17 | the led of the board will toggle until you press the button the task will be deleted from the scudeler you can se the SEGGER file from SEGGER dump and the gif using the button
18 |
19 |
--------------------------------------------------------------------------------
/LED_Button_Delete_Task/SEGGGER_Dump/001.SVdat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/LED_Button_Delete_Task/SEGGGER_Dump/001.SVdat
--------------------------------------------------------------------------------
/LED_Button_Delete_Task/output-image/Capture.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/LED_Button_Delete_Task/output-image/Capture.PNG
--------------------------------------------------------------------------------
/LED_Button_Delete_Task/output-image/IMG20221212215953.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/LED_Button_Delete_Task/output-image/IMG20221212215953.gif
--------------------------------------------------------------------------------
/LED_Button_Delete_Task/src/it.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx.h"
2 | #include "stm32f3xx_nucleo.h"
3 |
4 | extern USART_HandleTypeDef uart;
5 |
6 | void USART2_IRQHandler(void)
7 | {
8 |
9 | HAL_UART_IRQHandler(&uart);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/LED_Button_Delete_Task/src/main.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file main.c
4 | * @author Ac6
5 | * @version V1.0
6 | * @date 01-December-2013
7 | * @brief Default main function.
8 | ******************************************************************************
9 | */
10 |
11 | #include "stm32f3xx.h"
12 | #include "stm32f3xx_nucleo.h"
13 | #include "FreeRTOS.h"
14 | #include "task.h"
15 | #include "string.h"
16 | #include "SEGGER_SYSVIEW.h"
17 | //extern void initialise_monitor_handles();
18 |
19 | //some macros
20 | #define TRUE 1
21 | #define FALSE 0
22 | #define AVAILABLE TRUE
23 | #define NOT_AVAILABLE FALSE
24 |
25 | /*******************Variables**************************/
26 |
27 |
28 | uint16_t buttomValue=GPIO_PIN_RESET;
29 | TaskHandle_t xTaskHandler1 = NULL;
30 | TaskHandle_t xTaskHandler2 = NULL;
31 | TaskFunction_t pxTaskCode;
32 | UART_HandleTypeDef uart;
33 | char user_data[250];
34 | uint16_t UART_ACCESS_KEY = AVAILABLE;
35 |
36 | /*******************Functions**************************/
37 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
38 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG);
39 | void USART2_init(void);
40 | void GPIO_Init();
41 | void Error_handler();
42 | void prm(char *msg);
43 | void rtos_delay(uint32_t delay_in_ms);
44 | void ButtonTask(void *params);
45 | void LEDTask(void *params);
46 |
47 |
48 |
49 | int main(void) {
50 |
51 | DWT->CTRL |=(1<<0);
52 | //initialise_monitor_handles();
53 | HAL_Init();
54 | GPIO_Init();
55 | USART2_init();
56 |
57 | //sprintf(user_data,"the app is running \r\n");
58 | //prm(user_data);
59 |
60 | /*Start SEEGER Captures*/
61 | SEGGER_SYSVIEW_Conf();
62 | SEGGER_SYSVIEW_Start();
63 |
64 | /*Create two Taskes*/
65 | xTaskCreate(LEDTask, "LED Task", 500, NULL, 2,
66 | &xTaskHandler1);
67 | xTaskCreate(ButtonTask, "Button Task", 500, NULL, 2,
68 | &xTaskHandler2);
69 |
70 |
71 | vTaskStartScheduler();
72 | for (;;);
73 | }
74 |
75 | void LEDTask(void *params) {
76 | while (1) {
77 |
78 | //wait an event going to block state untilkl it recives an interrupt
79 | vTaskDelay(200);
80 | HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5);
81 |
82 |
83 | }
84 | }
85 | void ButtonTask(void *params) {
86 | while (1) {
87 | /*Check the state of the button*/
88 |
89 | if(HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13) == GPIO_PIN_SET)
90 | {
91 | rtos_delay(100);
92 | //Notify to the Handler of the led task
93 | HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5);
94 | }
95 | else{
96 | vTaskDelete(xTaskHandler1);
97 | }
98 | }
99 | }
100 | void USART2_init(void) {
101 |
102 | uart.Instance = USART2;
103 | uart.Init.BaudRate = 115200;
104 | uart.Init.Mode = USART_MODE_TX_RX;
105 | uart.Init.WordLength = UART_WORDLENGTH_8B;
106 | uart.Init.StopBits = USART_STOPBITS_1;
107 | uart.Init.Parity = USART_PARITY_NONE;
108 | uart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
109 | uart.Init.OverSampling = UART_OVERSAMPLING_16;
110 | while (HAL_UART_Init(&uart) != HAL_OK) {
111 | Error_handler();
112 | }
113 |
114 | }
115 | void GPIO_Init(){
116 |
117 | GPIO_InitTypeDef led_gpio,button_gpio;
118 | __HAL_RCC_GPIOA_CLK_ENABLE();
119 | __HAL_RCC_GPIOC_CLK_ENABLE();
120 | led_gpio.Mode=GPIO_MODE_OUTPUT_PP;
121 | led_gpio.Pin=GPIO_PIN_5;
122 | led_gpio.Speed=GPIO_SPEED_FREQ_MEDIUM;
123 | led_gpio.Pull=GPIO_NOPULL;
124 | HAL_GPIO_Init(GPIOA,&led_gpio);
125 |
126 | button_gpio.Mode=GPIO_MODE_INPUT;
127 | button_gpio.Pin=GPIO_PIN_13;
128 | button_gpio.Speed=GPIO_SPEED_FREQ_MEDIUM;
129 | button_gpio.Pull=GPIO_NOPULL;
130 | HAL_GPIO_Init(GPIOC,&button_gpio);
131 |
132 | }
133 | void Error_handler() {
134 |
135 | while (1)
136 | ;
137 | }
138 | void prm(char *msg) {
139 | uint16_t len = strlen(msg);
140 |
141 | for(uint32_t i=0;iTDR = (Data & (uint16_t)0x01FF);
150 | }
151 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG)
152 | {
153 | uint8_t bitstatus = RESET;
154 |
155 | if ((USARTx->ISR & USART_FLAG) != (uint16_t)RESET)
156 | {
157 | bitstatus = SET;
158 | }
159 | else
160 | {
161 | bitstatus = RESET;
162 | }
163 | return bitstatus;
164 | }
165 |
166 | void rtos_delay(uint32_t delay_in_ms){
167 |
168 | uint32_t current_ticks= xTaskGetTickCount();
169 | uint32_t delay_in_ticks=(delay_in_ms * configTICK_RATE_HZ) /1000;
170 | while(xTaskGetTickCount() <(current_ticks+delay_in_ticks));
171 | }
172 |
--------------------------------------------------------------------------------
/LED_Button_Delete_Task/src/msp.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx_hal.h"
2 |
3 | void HAL_UART_MspInit(UART_HandleTypeDef *huart)
4 | {
5 | __HAL_RCC_USART2_CLK_ENABLE();
6 | __HAL_RCC_GPIOA_CLK_ENABLE();
7 |
8 | GPIO_InitTypeDef gpio_init;
9 | gpio_init.Pin = GPIO_PIN_2 | GPIO_PIN_3;
10 | gpio_init.Mode = GPIO_MODE_AF_PP;
11 | gpio_init.Pull = GPIO_NOPULL;
12 | gpio_init.Alternate = GPIO_AF7_USART2;
13 |
14 | HAL_GPIO_Init(GPIOA , &gpio_init);
15 |
16 | HAL_NVIC_EnableIRQ(USART2_IRQn);
17 |
18 | HAL_NVIC_SetPriority(USART2_IRQn, 15, 0);
19 | }
20 | void HAL_MspInit(void)
21 | {
22 | NVIC_SetPriorityGrouping( 0 );
23 | }
24 |
--------------------------------------------------------------------------------
/LED_Button_Delete_Task/src/syscalls.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/LED_Button_Delete_Task/src/syscalls.c
--------------------------------------------------------------------------------
/LED_button_Notfiy/Middlewares/Third_Party/FreeRTOS/org/Source/include/StackMacros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.1.1
3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef STACK_MACROS_H
29 | #define STACK_MACROS_H
30 |
31 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */
32 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released.
33 | #endif
34 |
35 | /*
36 | * Call the stack overflow hook function if the stack of the task being swapped
37 | * out is currently overflowed, or looks like it might have overflowed in the
38 | * past.
39 | *
40 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
41 | * the current stack state only - comparing the current top of stack value to
42 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
43 | * will also cause the last few stack bytes to be checked to ensure the value
44 | * to which the bytes were set when the task was created have not been
45 | * overwritten. Note this second test does not guarantee that an overflowed
46 | * stack will always be recognised.
47 | */
48 |
49 | /*-----------------------------------------------------------*/
50 |
51 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
52 |
53 | /* Only the current stack state is to be checked. */
54 | #define taskCHECK_FOR_STACK_OVERFLOW() \
55 | { \
56 | /* Is the currently saved stack pointer within the stack limit? */ \
57 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
58 | { \
59 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
60 | } \
61 | }
62 |
63 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
64 | /*-----------------------------------------------------------*/
65 |
66 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
67 |
68 | /* Only the current stack state is to be checked. */
69 | #define taskCHECK_FOR_STACK_OVERFLOW() \
70 | { \
71 | \
72 | /* Is the currently saved stack pointer within the stack limit? */ \
73 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
74 | { \
75 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
76 | } \
77 | }
78 |
79 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
80 | /*-----------------------------------------------------------*/
81 |
82 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
83 |
84 | #define taskCHECK_FOR_STACK_OVERFLOW() \
85 | { \
86 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
87 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
88 | \
89 | if( ( pulStack[ 0 ] != ulCheckValue ) || \
90 | ( pulStack[ 1 ] != ulCheckValue ) || \
91 | ( pulStack[ 2 ] != ulCheckValue ) || \
92 | ( pulStack[ 3 ] != ulCheckValue ) ) \
93 | { \
94 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
95 | } \
96 | }
97 |
98 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
99 | /*-----------------------------------------------------------*/
100 |
101 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
102 |
103 | #define taskCHECK_FOR_STACK_OVERFLOW() \
104 | { \
105 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
106 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
107 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
108 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
109 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
110 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
111 | \
112 | \
113 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
114 | \
115 | /* Has the extremity of the task stack ever been written over? */ \
116 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
117 | { \
118 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
119 | } \
120 | }
121 |
122 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
123 | /*-----------------------------------------------------------*/
124 |
125 | /* Remove stack overflow macro if not being used. */
126 | #ifndef taskCHECK_FOR_STACK_OVERFLOW
127 | #define taskCHECK_FOR_STACK_OVERFLOW()
128 | #endif
129 |
130 |
131 |
132 | #endif /* STACK_MACROS_H */
133 |
134 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/Middlewares/Third_Party/FreeRTOS/org/Source/include/portable.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.1.1
3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*-----------------------------------------------------------
29 | * Portable layer API. Each function must be defined for each port.
30 | *----------------------------------------------------------*/
31 |
32 | #ifndef PORTABLE_H
33 | #define PORTABLE_H
34 |
35 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a
36 | pre-processor definition was used to ensure the pre-processor found the correct
37 | portmacro.h file for the port being used. That scheme was deprecated in favour
38 | of setting the compiler's include path such that it found the correct
39 | portmacro.h file - removing the need for the constant and allowing the
40 | portmacro.h file to be located anywhere in relation to the port being used.
41 | Purely for reasons of backward compatibility the old method is still valid, but
42 | to make it clear that new projects should not use it, support for the port
43 | specific constants has been moved into the deprecated_definitions.h header
44 | file. */
45 | #include "deprecated_definitions.h"
46 |
47 | /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
48 | did not result in a portmacro.h header file being included - and it should be
49 | included here. In this case the path to the correct portmacro.h header file
50 | must be set in the compiler's include path. */
51 | #ifndef portENTER_CRITICAL
52 | #include "portmacro.h"
53 | #endif
54 |
55 | #if portBYTE_ALIGNMENT == 32
56 | #define portBYTE_ALIGNMENT_MASK ( 0x001f )
57 | #endif
58 |
59 | #if portBYTE_ALIGNMENT == 16
60 | #define portBYTE_ALIGNMENT_MASK ( 0x000f )
61 | #endif
62 |
63 | #if portBYTE_ALIGNMENT == 8
64 | #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
65 | #endif
66 |
67 | #if portBYTE_ALIGNMENT == 4
68 | #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
69 | #endif
70 |
71 | #if portBYTE_ALIGNMENT == 2
72 | #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
73 | #endif
74 |
75 | #if portBYTE_ALIGNMENT == 1
76 | #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
77 | #endif
78 |
79 | #ifndef portBYTE_ALIGNMENT_MASK
80 | #error "Invalid portBYTE_ALIGNMENT definition"
81 | #endif
82 |
83 | #ifndef portNUM_CONFIGURABLE_REGIONS
84 | #define portNUM_CONFIGURABLE_REGIONS 1
85 | #endif
86 |
87 | #ifdef __cplusplus
88 | extern "C" {
89 | #endif
90 |
91 | #include "mpu_wrappers.h"
92 |
93 | /*
94 | * Setup the stack of a new task so it is ready to be placed under the
95 | * scheduler control. The registers have to be placed on the stack in
96 | * the order that the port expects to find them.
97 | *
98 | */
99 | #if( portUSING_MPU_WRAPPERS == 1 )
100 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
101 | #else
102 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
103 | #endif
104 |
105 | /* Used by heap_5.c. */
106 | typedef struct HeapRegion
107 | {
108 | uint8_t *pucStartAddress;
109 | size_t xSizeInBytes;
110 | } HeapRegion_t;
111 |
112 | /*
113 | * Used to define multiple heap regions for use by heap_5.c. This function
114 | * must be called before any calls to pvPortMalloc() - not creating a task,
115 | * queue, semaphore, mutex, software timer, event group, etc. will result in
116 | * pvPortMalloc being called.
117 | *
118 | * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
119 | * defines a region of memory that can be used as the heap. The array is
120 | * terminated by a HeapRegions_t structure that has a size of 0. The region
121 | * with the lowest start address must appear first in the array.
122 | */
123 | void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
124 |
125 |
126 | /*
127 | * Map to the memory management routines required for the port.
128 | */
129 | void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
130 | void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
131 | void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
132 | size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
133 | size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
134 |
135 | /*
136 | * Setup the hardware ready for the scheduler to take control. This generally
137 | * sets up a tick interrupt and sets timers for the correct tick frequency.
138 | */
139 | BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
140 |
141 | /*
142 | * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
143 | * the hardware is left in its original condition after the scheduler stops
144 | * executing.
145 | */
146 | void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
147 |
148 | /*
149 | * The structures and methods of manipulating the MPU are contained within the
150 | * port layer.
151 | *
152 | * Fills the xMPUSettings structure with the memory region information
153 | * contained in xRegions.
154 | */
155 | #if( portUSING_MPU_WRAPPERS == 1 )
156 | struct xMEMORY_REGION;
157 | void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
158 | #endif
159 |
160 | #ifdef __cplusplus
161 | }
162 | #endif
163 |
164 | #endif /* PORTABLE_H */
165 |
166 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/Middlewares/Third_Party/FreeRTOS/org/Source/include/projdefs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.1.1
3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef PROJDEFS_H
29 | #define PROJDEFS_H
30 |
31 | /*
32 | * Defines the prototype to which task functions must conform. Defined in this
33 | * file to ensure the type is known before portable.h is included.
34 | */
35 | typedef void (*TaskFunction_t)( void * );
36 |
37 | /* Converts a time in milliseconds to a time in ticks. This macro can be
38 | overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
39 | definition here is not suitable for your application. */
40 | #ifndef pdMS_TO_TICKS
41 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) )
42 | #endif
43 |
44 | #define pdFALSE ( ( BaseType_t ) 0 )
45 | #define pdTRUE ( ( BaseType_t ) 1 )
46 |
47 | #define pdPASS ( pdTRUE )
48 | #define pdFAIL ( pdFALSE )
49 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
50 | #define errQUEUE_FULL ( ( BaseType_t ) 0 )
51 |
52 | /* FreeRTOS error definitions. */
53 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
54 | #define errQUEUE_BLOCKED ( -4 )
55 | #define errQUEUE_YIELD ( -5 )
56 |
57 | /* Macros used for basic data corruption checks. */
58 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
59 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
60 | #endif
61 |
62 | #if( configUSE_16_BIT_TICKS == 1 )
63 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a
64 | #else
65 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
66 | #endif
67 |
68 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS
69 | itself. */
70 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */
71 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
72 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
73 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
74 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
75 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
76 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
77 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
78 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
79 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
80 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
81 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
82 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
83 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
84 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
85 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
86 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
87 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
88 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
89 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
90 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
91 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
92 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
93 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
94 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
95 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
96 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
97 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
98 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
99 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
100 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
101 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
102 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
103 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
104 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
105 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
106 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
107 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
108 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
109 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
110 |
111 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS
112 | itself. */
113 | #define pdFREERTOS_LITTLE_ENDIAN 0
114 | #define pdFREERTOS_BIG_ENDIAN 1
115 |
116 | /* Re-defining endian values for generic naming. */
117 | #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN
118 | #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN
119 |
120 |
121 | #endif /* PROJDEFS_H */
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/Middlewares/Third_Party/FreeRTOS/org/Source/include/stack_macros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.1.1
3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef STACK_MACROS_H
29 | #define STACK_MACROS_H
30 |
31 | /*
32 | * Call the stack overflow hook function if the stack of the task being swapped
33 | * out is currently overflowed, or looks like it might have overflowed in the
34 | * past.
35 | *
36 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
37 | * the current stack state only - comparing the current top of stack value to
38 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
39 | * will also cause the last few stack bytes to be checked to ensure the value
40 | * to which the bytes were set when the task was created have not been
41 | * overwritten. Note this second test does not guarantee that an overflowed
42 | * stack will always be recognised.
43 | */
44 |
45 | /*-----------------------------------------------------------*/
46 |
47 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
48 |
49 | /* Only the current stack state is to be checked. */
50 | #define taskCHECK_FOR_STACK_OVERFLOW() \
51 | { \
52 | /* Is the currently saved stack pointer within the stack limit? */ \
53 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
54 | { \
55 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
56 | } \
57 | }
58 |
59 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
60 | /*-----------------------------------------------------------*/
61 |
62 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
63 |
64 | /* Only the current stack state is to be checked. */
65 | #define taskCHECK_FOR_STACK_OVERFLOW() \
66 | { \
67 | \
68 | /* Is the currently saved stack pointer within the stack limit? */ \
69 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
70 | { \
71 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
72 | } \
73 | }
74 |
75 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
76 | /*-----------------------------------------------------------*/
77 |
78 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
79 |
80 | #define taskCHECK_FOR_STACK_OVERFLOW() \
81 | { \
82 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
83 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
84 | \
85 | if( ( pulStack[ 0 ] != ulCheckValue ) || \
86 | ( pulStack[ 1 ] != ulCheckValue ) || \
87 | ( pulStack[ 2 ] != ulCheckValue ) || \
88 | ( pulStack[ 3 ] != ulCheckValue ) ) \
89 | { \
90 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
91 | } \
92 | }
93 |
94 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
95 | /*-----------------------------------------------------------*/
96 |
97 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
98 |
99 | #define taskCHECK_FOR_STACK_OVERFLOW() \
100 | { \
101 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
102 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
103 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
104 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
105 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
106 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
107 | \
108 | \
109 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
110 | \
111 | /* Has the extremity of the task stack ever been written over? */ \
112 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
113 | { \
114 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
115 | } \
116 | }
117 |
118 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
119 | /*-----------------------------------------------------------*/
120 |
121 | /* Remove stack overflow macro if not being used. */
122 | #ifndef taskCHECK_FOR_STACK_OVERFLOW
123 | #define taskCHECK_FOR_STACK_OVERFLOW()
124 | #endif
125 |
126 |
127 |
128 | #endif /* STACK_MACROS_H */
129 |
130 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/Middlewares/Third_Party/SEGGER/Config/Global.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * SEGGER Microcontroller GmbH *
3 | * The Embedded Experts *
4 | **********************************************************************
5 | * *
6 | * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 | * *
8 | * www.segger.com Support: support@segger.com *
9 | * *
10 | **********************************************************************
11 | * *
12 | * SEGGER SystemView * Real-time application analysis *
13 | * *
14 | **********************************************************************
15 | * *
16 | * All rights reserved. *
17 | * *
18 | * SEGGER strongly recommends to not make any changes *
19 | * to or modify the source code of this software in order to stay *
20 | * compatible with the SystemView and RTT protocol, and J-Link. *
21 | * *
22 | * Redistribution and use in source and binary forms, with or *
23 | * without modification, are permitted provided that the following *
24 | * condition is met: *
25 | * *
26 | * o Redistributions of source code must retain the above copyright *
27 | * notice, this condition and the following disclaimer. *
28 | * *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 | * DAMAGE. *
42 | * *
43 | **********************************************************************
44 | * *
45 | * SystemView version: 3.30 *
46 | * *
47 | **********************************************************************
48 | ----------------------------------------------------------------------
49 | File : Global.h
50 | Purpose : Global types
51 | In case your application already has a Global.h, you should
52 | merge the files. In order to use Segger code, the types
53 | U8, U16, U32, I8, I16, I32 need to be defined in Global.h;
54 | additional definitions do not hurt.
55 | Revision: $Rev: 12501 $
56 | ---------------------------END-OF-HEADER------------------------------
57 | */
58 |
59 | #ifndef GLOBAL_H // Guard against multiple inclusion
60 | #define GLOBAL_H
61 |
62 | #define U8 unsigned char
63 | #define I8 signed char
64 | #define U16 unsigned short
65 | #define I16 signed short
66 | #ifdef __x86_64__
67 | #define U32 unsigned
68 | #define I32 int
69 | #else
70 | #define U32 unsigned long
71 | #define I32 signed long
72 | #endif
73 |
74 | //
75 | // CC_NO_LONG_SUPPORT can be defined to compile test
76 | // without long support for compilers that do not
77 | // support C99 and its long type.
78 | //
79 | #ifdef CC_NO_LONG_SUPPORT
80 | #define PTR_ADDR U32
81 | #else // Supports long type.
82 | #if defined(_WIN32) && !defined(__clang__) && !defined(__MINGW32__)
83 | //
84 | // Microsoft VC6 compiler related
85 | //
86 | #define U64 unsigned __int64
87 | #define U128 unsigned __int128
88 | #define I64 __int64
89 | #define I128 __int128
90 | #if _MSC_VER <= 1200
91 | #define U64_C(x) x##UI64
92 | #else
93 | #define U64_C(x) x##ULL
94 | #endif
95 | #else
96 | //
97 | // C99 compliant compiler
98 | //
99 | #define U64 unsigned long long
100 | #define I64 signed long long
101 | #define U64_C(x) x##ULL
102 | #endif
103 |
104 | #if (defined(_WIN64) || defined(__LP64__)) // 64-bit symbols used by Visual Studio and GCC, maybe others as well.
105 | #define PTR_ADDR U64
106 | #else
107 | #define PTR_ADDR U32
108 | #endif
109 | #endif // Supports long type.
110 |
111 | #endif // Avoid multiple inclusion
112 |
113 | /*************************** End of file ****************************/
114 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/Middlewares/Third_Party/SEGGER/Config/SEGGER_SYSVIEW_Conf.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * SEGGER Microcontroller GmbH *
3 | * The Embedded Experts *
4 | **********************************************************************
5 | * *
6 | * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 | * *
8 | * www.segger.com Support: support@segger.com *
9 | * *
10 | **********************************************************************
11 | * *
12 | * SEGGER SystemView * Real-time application analysis *
13 | * *
14 | **********************************************************************
15 | * *
16 | * All rights reserved. *
17 | * *
18 | * SEGGER strongly recommends to not make any changes *
19 | * to or modify the source code of this software in order to stay *
20 | * compatible with the SystemView and RTT protocol, and J-Link. *
21 | * *
22 | * Redistribution and use in source and binary forms, with or *
23 | * without modification, are permitted provided that the following *
24 | * condition is met: *
25 | * *
26 | * o Redistributions of source code must retain the above copyright *
27 | * notice, this condition and the following disclaimer. *
28 | * *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 | * DAMAGE. *
42 | * *
43 | **********************************************************************
44 | * *
45 | * SystemView version: 3.30 *
46 | * *
47 | **********************************************************************
48 | -------------------------- END-OF-HEADER -----------------------------
49 |
50 | File : SEGGER_SYSVIEW_Conf.h
51 | Purpose : SEGGER SystemView configuration file.
52 | Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
53 | Revision: $Rev: 21292 $
54 |
55 | Additional information:
56 | Required defines which must be set are:
57 | SEGGER_SYSVIEW_GET_TIMESTAMP
58 | SEGGER_SYSVIEW_GET_INTERRUPT_ID
59 | For known compilers and cores, these might be set to good defaults
60 | in SEGGER_SYSVIEW_ConfDefaults.h.
61 |
62 | SystemView needs a (nestable) locking mechanism.
63 | If not defined, the RTT locking mechanism is used,
64 | which then needs to be properly configured.
65 | */
66 |
67 | #ifndef SEGGER_SYSVIEW_CONF_H
68 | #define SEGGER_SYSVIEW_CONF_H
69 |
70 | /*********************************************************************
71 | *
72 | * Defines, configurable
73 | *
74 | **********************************************************************
75 | */
76 |
77 | /*********************************************************************
78 | * TODO: Add your defines here. *
79 | **********************************************************************
80 | */
81 |
82 | // Use internal recorder
83 | #define SEGGER_SYSVIEW_USE_INTERNAL_RECORDER 1
84 |
85 | #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
86 | #define SEGGER_SYSVIEW_RTT_BUFFER_SIZE (1024*8)
87 |
88 |
89 | #endif // SEGGER_SYSVIEW_CONF_H
90 |
91 | /*************************** End of file ****************************/
92 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/Middlewares/Third_Party/SEGGER/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * SEGGER Microcontroller GmbH *
3 | * The Embedded Experts *
4 | **********************************************************************
5 | * *
6 | * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 | * *
8 | * www.segger.com Support: support@segger.com *
9 | * *
10 | **********************************************************************
11 | * *
12 | * SEGGER SystemView * Real-time application analysis *
13 | * *
14 | **********************************************************************
15 | * *
16 | * All rights reserved. *
17 | * *
18 | * SEGGER strongly recommends to not make any changes *
19 | * to or modify the source code of this software in order to stay *
20 | * compatible with the SystemView and RTT protocol, and J-Link. *
21 | * *
22 | * Redistribution and use in source and binary forms, with or *
23 | * without modification, are permitted provided that the following *
24 | * condition is met: *
25 | * *
26 | * o Redistributions of source code must retain the above copyright *
27 | * notice, this condition and the following disclaimer. *
28 | * *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 | * DAMAGE. *
42 | * *
43 | **********************************************************************
44 | * *
45 | * SystemView version: 3.30 *
46 | * *
47 | **********************************************************************
48 | -------------------------- END-OF-HEADER -----------------------------
49 |
50 | File : SEGGER_SYSVIEW_Config_FreeRTOS.c
51 | Purpose : Sample setup configuration of SystemView with FreeRTOS.
52 | Revision: $Rev: 7745 $
53 | */
54 | #include "FreeRTOS.h"
55 | #include "SEGGER_SYSVIEW.h"
56 |
57 | extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
58 |
59 | /*********************************************************************
60 | *
61 | * Defines, configurable
62 | *
63 | **********************************************************************
64 | */
65 | // The application name to be displayed in SystemViewer
66 | #define SYSVIEW_APP_NAME "Hello APP"
67 |
68 | // The target device name
69 | #define SYSVIEW_DEVICE_NAME "NECLEO-F303RE"
70 |
71 | // Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
72 | #define SYSVIEW_TIMESTAMP_FREQ (configCPU_CLOCK_HZ)
73 |
74 | // System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
75 | #define SYSVIEW_CPU_FREQ configCPU_CLOCK_HZ
76 |
77 | // The lowest RAM address used for IDs (pointers)
78 | #define SYSVIEW_RAM_BASE (0x10000000)
79 |
80 | #define DEMCR (*(volatile U32*) (0xE000EDFCuL))
81 | // Debug Exception and Monitor Control Register
82 | #define TRACEENA_BIT (1uL << 24) // Trace enable bit
83 | #define DWT_CTRL (*(volatile U32*) (0xE0001000uL)) // DWT Control Register
84 | #define NOCYCCNT_BIT (1uL << 25)
85 | // Cycle counter support bit
86 | #define CYCCNTENA_BIT (1uL << 0)
87 | // Cycle counter enable bit
88 | //
89 | // If events will be recorded without a debug probe (J-Link) attached,
90 | // enable the cycle counter
91 | //
92 | #define ENABLE_DWT_CYCCNT (SEGGER_SYSVIEW_POST_MORTEM_MODE || SEGGER_SYSVIEW_USE_INTERNAL_RECORDER)
93 |
94 | /*********************************************************************
95 | *
96 | * _cbSendSystemDesc()
97 | *
98 | * Function description
99 | * Sends SystemView description strings.
100 | */
101 | static void _cbSendSystemDesc(void) {
102 | SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=FreeRTOS");
103 | SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
104 | }
105 |
106 | /*********************************************************************
107 | *
108 | * Global functions
109 | *
110 | **********************************************************************
111 | */
112 | void SEGGER_SYSVIEW_Conf(void) {
113 |
114 | #if ENABLE_DWT_CYCCNT
115 | //
116 | // If no debugger is connected, the DWT must be enabled by the application
117 | //
118 | if ((DEMCR & TRACEENA_BIT) == 0)
119 | {
120 | DEMCR |= TRACEENA_BIT;
121 | }
122 | #endif
123 |
124 | //
125 | // The cycle counter must be activated in order
126 | // to use time related functions.
127 | //
128 | if ((DWT_CTRL & NOCYCCNT_BIT) == 0)
129 | {
130 | // Cycle counter supported?
131 | if ((DWT_CTRL & CYCCNTENA_BIT) == 0)
132 | {
133 | // Cycle counter not enabled?
134 | DWT_CTRL |= CYCCNTENA_BIT; // Enable Cycle counter
135 | }
136 | }
137 | SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
138 | &SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
139 | SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
140 | }
141 |
142 | /*************************** End of file ****************************/
143 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/Middlewares/Third_Party/SEGGER/SEGGER/SEGGER_SYSVIEW_Int.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * SEGGER Microcontroller GmbH *
3 | * The Embedded Experts *
4 | **********************************************************************
5 | * *
6 | * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 | * *
8 | * www.segger.com Support: support@segger.com *
9 | * *
10 | **********************************************************************
11 | * *
12 | * SEGGER SystemView * Real-time application analysis *
13 | * *
14 | **********************************************************************
15 | * *
16 | * All rights reserved. *
17 | * *
18 | * SEGGER strongly recommends to not make any changes *
19 | * to or modify the source code of this software in order to stay *
20 | * compatible with the SystemView and RTT protocol, and J-Link. *
21 | * *
22 | * Redistribution and use in source and binary forms, with or *
23 | * without modification, are permitted provided that the following *
24 | * condition is met: *
25 | * *
26 | * o Redistributions of source code must retain the above copyright *
27 | * notice, this condition and the following disclaimer. *
28 | * *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 | * DAMAGE. *
42 | * *
43 | **********************************************************************
44 | * *
45 | * SystemView version: 3.30 *
46 | * *
47 | **********************************************************************
48 | -------------------------- END-OF-HEADER -----------------------------
49 | File : SEGGER_SYSVIEW_Int.h
50 | Purpose : SEGGER SystemView internal header.
51 | Revision: $Rev: 21281 $
52 | */
53 |
54 | #ifndef SEGGER_SYSVIEW_INT_H
55 | #define SEGGER_SYSVIEW_INT_H
56 |
57 | /*********************************************************************
58 | *
59 | * #include Section
60 | *
61 | **********************************************************************
62 | */
63 |
64 | #include "SEGGER_SYSVIEW.h"
65 |
66 | #ifdef __cplusplus
67 | extern "C" {
68 | #endif
69 |
70 |
71 | /*********************************************************************
72 | *
73 | * Private data types
74 | *
75 | **********************************************************************
76 | */
77 | //
78 | // Commands that Host can send to target
79 | //
80 | typedef enum {
81 | SEGGER_SYSVIEW_COMMAND_ID_START = 1,
82 | SEGGER_SYSVIEW_COMMAND_ID_STOP,
83 | SEGGER_SYSVIEW_COMMAND_ID_GET_SYSTIME,
84 | SEGGER_SYSVIEW_COMMAND_ID_GET_TASKLIST,
85 | SEGGER_SYSVIEW_COMMAND_ID_GET_SYSDESC,
86 | SEGGER_SYSVIEW_COMMAND_ID_GET_NUMMODULES,
87 | SEGGER_SYSVIEW_COMMAND_ID_GET_MODULEDESC,
88 | SEGGER_SYSVIEW_COMMAND_ID_HEARTBEAT = 127,
89 | // Extended commands: Commands >= 128 have a second parameter
90 | SEGGER_SYSVIEW_COMMAND_ID_GET_MODULE = 128
91 | } SEGGER_SYSVIEW_COMMAND_ID;
92 |
93 | #ifdef __cplusplus
94 | }
95 | #endif
96 |
97 | #endif
98 |
99 | /*************************** End of file ****************************/
100 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/README.md:
--------------------------------------------------------------------------------
1 | # FreeRTOS Template
2 |
3 | ## In this part New Functions APIs we gonna use
4 |
5 | BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify,
6 | uint32_t ulValue,
7 | eNotifyAction eAction );
8 |
9 |
10 | - TaskNotify() is used to send an event directly to and potentially unblock an RTOS task
11 |
12 | **Parameter**\
13 | TaskHandle_t xTaskToNotify : The handle of the RTOS task being notified. This is the target task.
14 | uint32_t ulValue : Used to update the notification value of the target task.
15 | eNotifyAction eAction : An enumerated type that can take one of the values documented in the table below in order to perform the associated action.
16 |
17 | eAction have multible possible case :
18 | - eNoAction = 0 Notify the task without updating its notify value
19 | - eSetBits, Set bits in the task's notification value.
20 | - eIncrement Increment the task's notification value.
21 | - eSetValueWithOverwrite Set the task's notification value to a specific value even if the previous value has not yet been read by the task.
22 | - eSetValueWithoutOverwrite Set the task's notification value if the previous value has been read by the task.
23 |
24 | xTaskNotifyWait( uint32_t ulBitsToClearOnEntry,
25 | uint32_t ulBitsToClearOnExit,
26 | uint32_t *pulNotificationValue,
27 | TickType_t xTicksToWait );
28 |
29 | - this function used to wait until an event happen
30 |
31 | **Parameter**
32 | - uint32_t ulBitsToClearOnEntry : if ulBitsToClearOnEntry is 0x01, then bit 0 of the task's notification value will be cleared on entry to the function.
33 | - uint32_t ulBitsToClearOnExit : if ulBitsToClearOnExit is 0x03, then bit 0 and bit 1 of the task's notification value will be cleared before the function exits.
34 | - uint32_t *pulNotificationValue : Used to pass out the RTOS task's notification value.
35 | - TickType_t xTicksToWait : The maximum time to wait in the Blocked state for a notification to be received if a notification is not already pending when xTaskNotifyWait() is called.
36 |
37 | __flowcontrol__
38 | - when the button is pressed the buttontask is goning to notfiy the led task to work without pressing the ledtask will be blocked
39 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/SEGGGER_Dump/001.SVdat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/LED_button_Notfiy/SEGGGER_Dump/001.SVdat
--------------------------------------------------------------------------------
/LED_button_Notfiy/SEGGGER_Dump/002.SVdat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/LED_button_Notfiy/SEGGGER_Dump/002.SVdat
--------------------------------------------------------------------------------
/LED_button_Notfiy/inc/FreeRTOSConfig.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.1.1
3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 |
29 | #ifndef FREERTOS_CONFIG_H
30 | #define FREERTOS_CONFIG_H
31 |
32 | /*-----------------------------------------------------------
33 | * Application specific definitions.
34 | *
35 | * These definitions should be adjusted for your particular hardware and
36 | * application requirements.
37 | *
38 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
39 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
40 | *
41 | * See http://www.freertos.org/a00110.html
42 | *----------------------------------------------------------*/
43 |
44 | /* Ensure stdint is only used by the compiler, and not the assembler. */
45 | #ifdef __ICCARM__
46 | #include
47 | extern uint32_t SystemCoreClock;
48 | #endif
49 | extern uint32_t SystemCoreClock;
50 |
51 | #define configUSE_PREEMPTION 1
52 | #define configUSE_IDLE_HOOK 0
53 | #define configUSE_TICK_HOOK 0
54 | #define configCPU_CLOCK_HZ ( SystemCoreClock )
55 | #define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
56 | #define configMAX_PRIORITIES ( 5 )
57 | #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 )
58 | #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) )
59 | #define configMAX_TASK_NAME_LEN ( 10 )
60 | #define configUSE_TRACE_FACILITY 1
61 | #define configUSE_16_BIT_TICKS 0
62 | #define configIDLE_SHOULD_YIELD 1
63 | #define configUSE_MUTEXES 1
64 | #define configQUEUE_REGISTRY_SIZE 8
65 | #define configCHECK_FOR_STACK_OVERFLOW 0
66 | #define configUSE_RECURSIVE_MUTEXES 1
67 | #define configUSE_MALLOC_FAILED_HOOK 0
68 | #define configUSE_APPLICATION_TASK_TAG 0
69 | #define configUSE_COUNTING_SEMAPHORES 1
70 | #define configGENERATE_RUN_TIME_STATS 0
71 |
72 | /* Co-routine definitions. */
73 | #define configUSE_CO_ROUTINES 0
74 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
75 |
76 | /* Software timer definitions. */
77 | #define configUSE_TIMERS 0
78 | #define configTIMER_TASK_PRIORITY ( 2 )
79 | #define configTIMER_QUEUE_LENGTH 10
80 | #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
81 |
82 | /* Set the following definitions to 1 to include the API function, or zero
83 | to exclude the API function. */
84 | #define INCLUDE_vTaskPrioritySet 1
85 | #define INCLUDE_uxTaskPriorityGet 1
86 | #define INCLUDE_vTaskDelete 1
87 | #define INCLUDE_vTaskCleanUpResources 1
88 | #define INCLUDE_vTaskSuspend 1
89 | #define INCLUDE_vTaskDelayUntil 1
90 | #define INCLUDE_vTaskDelay 1
91 | #define INCLUDE_xTaskGetIdleTaskHandle 1
92 | #define INCLUDE_pxTaskGetStackStart 1
93 |
94 | /* Cortex-M specific definitions. */
95 | #ifdef __NVIC_PRIO_BITS
96 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
97 | #define configPRIO_BITS __NVIC_PRIO_BITS
98 | #else
99 | #define configPRIO_BITS 4 /* 15 priority levels */
100 | #endif
101 |
102 | /* The lowest interrupt priority that can be used in a call to a "set priority"
103 | function. */
104 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
105 |
106 | /* The highest interrupt priority that can be used by any interrupt service
107 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
108 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
109 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */
110 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
111 |
112 | /* Interrupt priorities used by the kernel port layer itself. These are generic
113 | to all Cortex-M ports, and do not rely on any particular library functions. */
114 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
115 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
116 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
117 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
118 |
119 | /* Normal assert() semantics without relying on the provision of an assert.h
120 | header file. */
121 | #define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
122 |
123 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
124 | standard names. */
125 | #define vPortSVCHandler SVC_Handler
126 | #define xPortPendSVHandler PendSV_Handler
127 | #define xPortSysTickHandler SysTick_Handler
128 |
129 | #include "SEGGER_SYSVIEW_FreeRTOS.h"
130 |
131 | #endif /* FREERTOS_CONFIG_H */
132 |
133 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/inc/inc/FreeRTOSConfig.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.1.1
3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 |
29 | #ifndef FREERTOS_CONFIG_H
30 | #define FREERTOS_CONFIG_H
31 |
32 | /*-----------------------------------------------------------
33 | * Application specific definitions.
34 | *
35 | * These definitions should be adjusted for your particular hardware and
36 | * application requirements.
37 | *
38 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
39 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
40 | *
41 | * See http://www.freertos.org/a00110.html
42 | *----------------------------------------------------------*/
43 |
44 | /* Ensure stdint is only used by the compiler, and not the assembler. */
45 | #ifdef __ICCARM__
46 | #include
47 | extern uint32_t SystemCoreClock;
48 | #endif
49 | extern uint32_t SystemCoreClock;
50 |
51 | #define configUSE_PREEMPTION 1
52 | #define configUSE_IDLE_HOOK 0
53 | #define configUSE_TICK_HOOK 0
54 | #define configCPU_CLOCK_HZ ( SystemCoreClock )
55 | #define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
56 | #define configMAX_PRIORITIES ( 5 )
57 | #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 )
58 | #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) )
59 | #define configMAX_TASK_NAME_LEN ( 10 )
60 | #define configUSE_TRACE_FACILITY 1
61 | #define configUSE_16_BIT_TICKS 0
62 | #define configIDLE_SHOULD_YIELD 1
63 | #define configUSE_MUTEXES 1
64 | #define configQUEUE_REGISTRY_SIZE 8
65 | #define configCHECK_FOR_STACK_OVERFLOW 0
66 | #define configUSE_RECURSIVE_MUTEXES 1
67 | #define configUSE_MALLOC_FAILED_HOOK 0
68 | #define configUSE_APPLICATION_TASK_TAG 0
69 | #define configUSE_COUNTING_SEMAPHORES 1
70 | #define configGENERATE_RUN_TIME_STATS 0
71 |
72 | /* Co-routine definitions. */
73 | #define configUSE_CO_ROUTINES 0
74 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
75 |
76 | /* Software timer definitions. */
77 | #define configUSE_TIMERS 0
78 | #define configTIMER_TASK_PRIORITY ( 2 )
79 | #define configTIMER_QUEUE_LENGTH 10
80 | #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
81 |
82 | /* Set the following definitions to 1 to include the API function, or zero
83 | to exclude the API function. */
84 | #define INCLUDE_vTaskPrioritySet 1
85 | #define INCLUDE_uxTaskPriorityGet 1
86 | #define INCLUDE_vTaskDelete 1
87 | #define INCLUDE_vTaskCleanUpResources 1
88 | #define INCLUDE_vTaskSuspend 1
89 | #define INCLUDE_vTaskDelayUntil 1
90 | #define INCLUDE_vTaskDelay 1
91 | #define INCLUDE_xTaskGetIdleTaskHandle 1
92 | #define INCLUDE_pxTaskGetStackStart 1
93 |
94 | /* Cortex-M specific definitions. */
95 | #ifdef __NVIC_PRIO_BITS
96 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
97 | #define configPRIO_BITS __NVIC_PRIO_BITS
98 | #else
99 | #define configPRIO_BITS 4 /* 15 priority levels */
100 | #endif
101 |
102 | /* The lowest interrupt priority that can be used in a call to a "set priority"
103 | function. */
104 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
105 |
106 | /* The highest interrupt priority that can be used by any interrupt service
107 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
108 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
109 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */
110 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
111 |
112 | /* Interrupt priorities used by the kernel port layer itself. These are generic
113 | to all Cortex-M ports, and do not rely on any particular library functions. */
114 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
115 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
116 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
117 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
118 |
119 | /* Normal assert() semantics without relying on the provision of an assert.h
120 | header file. */
121 | #define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
122 |
123 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
124 | standard names. */
125 | #define vPortSVCHandler SVC_Handler
126 | #define xPortPendSVHandler PendSV_Handler
127 | #define xPortSysTickHandler SysTick_Handler
128 |
129 | #include "SEGGER_SYSVIEW_FreeRTOS.h"
130 |
131 | #endif /* FREERTOS_CONFIG_H */
132 |
133 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/output-image/Capture.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/LED_button_Notfiy/output-image/Capture.PNG
--------------------------------------------------------------------------------
/LED_button_Notfiy/src/it.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx.h"
2 | #include "stm32f3xx_nucleo.h"
3 |
4 | extern USART_HandleTypeDef uart;
5 |
6 | void USART2_IRQHandler(void)
7 | {
8 |
9 | HAL_UART_IRQHandler(&uart);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/src/main.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file main.c
4 | * @author Abdallah rabie
5 | * @version V1.0
6 | * @date 01-December-2013
7 | * @brief Default main function.
8 | ******************************************************************************
9 | */
10 |
11 | #include "stm32f3xx.h"
12 | #include "stm32f3xx_nucleo.h"
13 | #include "FreeRTOS.h"
14 | #include "task.h"
15 | #include "string.h"
16 | #include "SEGGER_SYSVIEW.h"
17 | //extern void initialise_monitor_handles();
18 |
19 | //some macros
20 |
21 |
22 | /*******************Variables**************************/
23 |
24 |
25 | uint16_t buttomValue=GPIO_PIN_RESET;
26 | TaskHandle_t xTaskHandler1 = NULL;
27 | TaskHandle_t xTaskHandler2 = NULL;
28 | TaskFunction_t pxTaskCode;
29 | UART_HandleTypeDef uart;
30 | char user_data[250];
31 |
32 |
33 | /*******************Functions**************************/
34 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
35 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG);
36 | void USART2_init(void);
37 | void GPIO_Init();
38 | void Error_handler();
39 | void prm(char *msg);
40 | void rtos_delay(uint32_t delay_in_ms);
41 | void ButtonTask(void *params);
42 | void LEDTask(void *params);
43 |
44 |
45 |
46 | int main(void) {
47 |
48 | DWT->CTRL |=(1<<0);
49 | //initialise_monitor_handles();
50 | HAL_Init();
51 | GPIO_Init();
52 | USART2_init();
53 |
54 | //sprintf(user_data,"the app is running \r\n");
55 | //prm(user_data);
56 |
57 | /*Start SEEGER Captures*/
58 | SEGGER_SYSVIEW_Conf();
59 | SEGGER_SYSVIEW_Start();
60 |
61 | /*Create two Taskes*/
62 | xTaskCreate(LEDTask, "LED Task", 500, NULL, 2,
63 | &xTaskHandler1);
64 | xTaskCreate(ButtonTask, "Button Task", 500, NULL, 2,
65 | &xTaskHandler2);
66 |
67 |
68 | vTaskStartScheduler();
69 | for (;;);
70 | }
71 |
72 | void LEDTask(void *params) {
73 | while (1) {
74 | uint32_t current_count=0;
75 | if(xTaskNotifyWait(0,0,¤t_count,portMAX_DELAY) == pdTRUE){
76 | HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5);
77 | sprintf(user_data,"Notification is received : Button press count : %ld \r\n",current_count);
78 | prm(user_data);
79 | }
80 |
81 |
82 | }
83 | }
84 | void ButtonTask(void *params) {
85 | while (1) {
86 |
87 |
88 | if(HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13) == GPIO_PIN_RESET)
89 | {
90 | rtos_delay(100);
91 |
92 | xTaskNotify(xTaskHandler1,0x0,eIncrement);
93 | }
94 | }
95 | }
96 | void USART2_init(void) {
97 |
98 | uart.Instance = USART2;
99 | uart.Init.BaudRate = 115200;
100 | uart.Init.Mode = USART_MODE_TX_RX;
101 | uart.Init.WordLength = UART_WORDLENGTH_8B;
102 | uart.Init.StopBits = USART_STOPBITS_1;
103 | uart.Init.Parity = USART_PARITY_NONE;
104 | uart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
105 | uart.Init.OverSampling = UART_OVERSAMPLING_16;
106 | while (HAL_UART_Init(&uart) != HAL_OK) {
107 | Error_handler();
108 | }
109 |
110 | }
111 | void GPIO_Init(){
112 |
113 | GPIO_InitTypeDef led_gpio,button_gpio;
114 | __HAL_RCC_GPIOA_CLK_ENABLE();
115 | __HAL_RCC_GPIOC_CLK_ENABLE();
116 | led_gpio.Mode=GPIO_MODE_OUTPUT_PP;
117 | led_gpio.Pin=GPIO_PIN_5;
118 | led_gpio.Speed=GPIO_SPEED_FREQ_MEDIUM;
119 | led_gpio.Pull=GPIO_NOPULL;
120 | HAL_GPIO_Init(GPIOA,&led_gpio);
121 |
122 | button_gpio.Mode=GPIO_MODE_INPUT;
123 | button_gpio.Pin=GPIO_PIN_13;
124 | button_gpio.Speed=GPIO_SPEED_FREQ_MEDIUM;
125 | button_gpio.Pull=GPIO_NOPULL;
126 | HAL_GPIO_Init(GPIOC,&button_gpio);
127 |
128 | }
129 | void Error_handler() {
130 |
131 | while (1)
132 | ;
133 | }
134 | void prm(char *msg) {
135 | uint16_t len = strlen(msg);
136 |
137 | for(uint32_t i=0;iTDR = (Data & (uint16_t)0x01FF);
146 | }
147 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG)
148 | {
149 | uint8_t bitstatus = RESET;
150 |
151 | if ((USARTx->ISR & USART_FLAG) != (uint16_t)RESET)
152 | {
153 | bitstatus = SET;
154 | }
155 | else
156 | {
157 | bitstatus = RESET;
158 | }
159 | return bitstatus;
160 | }
161 |
162 | void rtos_delay(uint32_t delay_in_ms){
163 |
164 | uint32_t current_ticks= xTaskGetTickCount();
165 | uint32_t delay_in_ticks=(delay_in_ms * configTICK_RATE_HZ) /1000;
166 | while(xTaskGetTickCount() <(current_ticks+delay_in_ticks));
167 | }
168 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/src/msp.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx_hal.h"
2 |
3 | void HAL_UART_MspInit(UART_HandleTypeDef *huart)
4 | {
5 | __HAL_RCC_USART2_CLK_ENABLE();
6 | __HAL_RCC_GPIOA_CLK_ENABLE();
7 |
8 | GPIO_InitTypeDef gpio_init;
9 | gpio_init.Pin = GPIO_PIN_2 | GPIO_PIN_3;
10 | gpio_init.Mode = GPIO_MODE_AF_PP;
11 | gpio_init.Pull = GPIO_NOPULL;
12 | gpio_init.Alternate = GPIO_AF7_USART2;
13 |
14 | HAL_GPIO_Init(GPIOA , &gpio_init);
15 |
16 | HAL_NVIC_EnableIRQ(USART2_IRQn);
17 |
18 | HAL_NVIC_SetPriority(USART2_IRQn, 15, 0);
19 | }
20 | void HAL_MspInit(void)
21 | {
22 | NVIC_SetPriorityGrouping( 0 );
23 | }
24 |
--------------------------------------------------------------------------------
/LED_button_Notfiy/src/syscalls.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/LED_button_Notfiy/src/syscalls.c
--------------------------------------------------------------------------------
/Queue_Create/README.md:
--------------------------------------------------------------------------------
1 | # Queue Creation
2 | if you dont know any thing about queue (https://www.geeksforgeeks.org/queue-data-structure/)
3 | ## In this part New Functions APIs we gonna use
4 | - QueueHandle_t xQueueCreate( UBaseType_t uxQueueLength,
5 | UBaseType_t uxItemSize );
6 |
7 | Creates a new queue and returns a handle by which the queue can be referenced.(xQueue in the exrcise)
8 | ## Parameters:
9 | - uxQueueLength The maximum number of items the queue can hold at any one time.
10 | - uxItemSize The size, in bytes, required to hold each item in the queue.
11 |
12 | - BaseType_t xQueueSendToFront( QueueHandle_t xQueue,
13 | const void * pvItemToQueue,
14 | TickType_t xTicksToWait );
15 |
16 |
17 | ## Parameters:
18 |
19 | - xQueue The handle to the queue on which the item is to be posted.
20 | - pvItemToQueue A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pvItemToQueue into the queue storage area.
21 | - xTicksToWait The maximum amount of time the task should block waiting for space to become available on the queue, should it already be full. The call will return immediately if this is set to 0. The time is defined in tick periods so the constant portTICK_PERIOD_MS should be used to convert to real time if this is required.
22 |
23 | - xQueueSendToBack the same as previous
24 |
25 |
26 | __flowcontrol__
27 | - Create Queue
28 | - Add some values from the from and the back
29 | - Revome this values from the queue and store them in place holder
30 |
--------------------------------------------------------------------------------
/Queue_Create/src/it.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx.h"
2 | #include "stm32f3xx_nucleo.h"
3 |
4 | extern USART_HandleTypeDef uart;
5 |
6 | void USART2_IRQHandler(void)
7 | {
8 |
9 | HAL_UART_IRQHandler(&uart);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/Queue_Create/src/main.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file main.c
4 | * @author Ac6
5 | * @version V1.0
6 | * @date 01-December-2013
7 | * @brief Default main function.
8 | ******************************************************************************
9 | */
10 |
11 | #include "stm32f3xx.h"
12 | #include "stm32f3xx_nucleo.h"
13 | #include "FreeRTOS.h"
14 | #include "task.h"
15 | #include "string.h"
16 | #include "SEGGER_SYSVIEW.h"
17 | #include "semphr.h"
18 | //extern void initialise_monitor_handles();
19 |
20 | //some macros
21 | #define TRUE 1
22 | #define FALSE 0
23 | #define AVAILABLE TRUE
24 | #define NOT_AVAILABLE FALSE
25 |
26 | /*******************Variables**************************/
27 |
28 | uint16_t buttomValue = GPIO_PIN_RESET;
29 | TaskHandle_t xTaskHandler1 = NULL;
30 | TaskHandle_t xTaskHandler2 = NULL;
31 |
32 | xQueueHandle xQueue1, xQueue2;
33 |
34 | TaskFunction_t pxTaskCode;
35 | UART_HandleTypeDef uart;
36 | char user_data[250];
37 | uint16_t UART_ACCESS_KEY = AVAILABLE;
38 | unsigned int value1 = 150UL, value2 = 151UL, value3 = 152UL, value4 = 153UL,rvValue1,rvValue2,rvValue3,rvValue4;
39 | /* xQueueSendToFront
40 | * xQueueSendToBack
41 | * handle- address of data to pass-time to wait
42 | * xQueueReceive()
43 | * handle- place holder-time to wait
44 | * xQueuePeek()
45 | */
46 | /*******************Functions**************************/
47 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
48 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG);
49 | void USART2_init(void);
50 | void GPIO_Init();
51 | void Error_handler();
52 | void prm(char *msg);
53 | void rtos_delay(uint32_t delay_in_ms);
54 | void vEmployeTask(void *params);
55 | void vMangerTask(void *params);
56 | void EmployeDoWork(unsigned char TicketID);
57 |
58 | int main(void) {
59 |
60 | DWT->CTRL |= (1 << 0);
61 | //initialise_monitor_handles();
62 | HAL_Init();
63 | GPIO_Init();
64 | USART2_init();
65 |
66 | xQueue1 = xQueueCreate(10, sizeof(unsigned int));
67 | /*Create two Taskes*/
68 | if (xQueue1 != NULL) {
69 | //No space in the queue
70 | xQueueSendToFront(xQueue1, (void* ) &value1, portMAX_DELAY);
71 | xQueueSendToFront(xQueue1, (void* ) &value2, portMAX_DELAY);
72 | xQueueSendToFront(xQueue1, (void* ) &value3, portMAX_DELAY);
73 | xQueueSendToFront(xQueue1, (void* ) &value4, portMAX_DELAY);
74 | xQueueSendToFront(xQueue1, (void* ) &value1, portMAX_DELAY);
75 | xQueueSendToBack(xQueue1, (void* ) &value2, portMAX_DELAY);
76 | xQueueSendToBack(xQueue1, (void* ) &value3, portMAX_DELAY);
77 | xQueueSendToBack(xQueue1, (void* ) &value4, portMAX_DELAY);
78 |
79 | xQueueReceive(xQueue1,(void*)rvValue1,portMAX_DELAY);
80 | xQueueReceive(xQueue1,(void*)rvValue2,portMAX_DELAY);
81 | xQueueReceive(xQueue1,(void*)rvValue3,portMAX_DELAY);
82 | xQueueReceive(xQueue1,(void*)rvValue4,portMAX_DELAY);
83 |
84 |
85 | }
86 | for (;;)
87 | ;
88 | }
89 |
90 | void USART2_init(void) {
91 |
92 | uart.Instance = USART2;
93 | uart.Init.BaudRate = 115200;
94 | uart.Init.Mode = USART_MODE_TX_RX;
95 | uart.Init.WordLength = UART_WORDLENGTH_8B;
96 | uart.Init.StopBits = USART_STOPBITS_1;
97 | uart.Init.Parity = USART_PARITY_NONE;
98 | uart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
99 | uart.Init.OverSampling = UART_OVERSAMPLING_16;
100 | while (HAL_UART_Init(&uart) != HAL_OK) {
101 | Error_handler();
102 | }
103 |
104 | }
105 | void GPIO_Init() {
106 |
107 | GPIO_InitTypeDef led_gpio, button_gpio;
108 | __HAL_RCC_GPIOA_CLK_ENABLE()
109 | ;
110 | __HAL_RCC_GPIOC_CLK_ENABLE()
111 | ;
112 | led_gpio.Mode = GPIO_MODE_OUTPUT_PP;
113 | led_gpio.Pin = GPIO_PIN_5;
114 | led_gpio.Speed = GPIO_SPEED_FREQ_MEDIUM;
115 | led_gpio.Pull = GPIO_NOPULL;
116 | HAL_GPIO_Init(GPIOA, &led_gpio);
117 |
118 | button_gpio.Mode = GPIO_MODE_INPUT;
119 | button_gpio.Pin = GPIO_PIN_13;
120 | button_gpio.Speed = GPIO_SPEED_FREQ_MEDIUM;
121 | button_gpio.Pull = GPIO_NOPULL;
122 | HAL_GPIO_Init(GPIOC, &button_gpio);
123 |
124 | }
125 | void Error_handler() {
126 |
127 | while (1)
128 | ;
129 | }
130 | void prm(char *msg) {
131 | uint16_t len = strlen(msg);
132 |
133 | for (uint32_t i = 0; i < len; i++) {
134 | while (USART_GetFlagStatus(USART2, USART_FLAG_TXE) != SET)
135 | ;
136 | USART_SendData(USART2, msg[i]);
137 | }
138 | }
139 | void USART_SendData(USART_TypeDef* USARTx, uint16_t Data) {
140 | /* Transmit Data */
141 | USARTx->TDR = (Data & (uint16_t) 0x01FF);
142 | }
143 | uint8_t USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG) {
144 | uint8_t bitstatus = RESET;
145 |
146 | if ((USARTx->ISR & USART_FLAG) != (uint16_t) RESET) {
147 | bitstatus = SET;
148 | } else {
149 | bitstatus = RESET;
150 | }
151 | return bitstatus;
152 | }
153 |
154 | void rtos_delay(uint32_t delay_in_ms) {
155 |
156 | uint32_t current_ticks = xTaskGetTickCount();
157 | uint32_t delay_in_ticks = (delay_in_ms * configTICK_RATE_HZ) / 1000;
158 | while (xTaskGetTickCount() < (current_ticks + delay_in_ticks))
159 | ;
160 | }
161 |
--------------------------------------------------------------------------------
/Queue_Create/src/msp.c:
--------------------------------------------------------------------------------
1 | #include "stm32f3xx_hal.h"
2 |
3 | void HAL_UART_MspInit(UART_HandleTypeDef *huart)
4 | {
5 | __HAL_RCC_USART2_CLK_ENABLE();
6 | __HAL_RCC_GPIOA_CLK_ENABLE();
7 |
8 | GPIO_InitTypeDef gpio_init;
9 | gpio_init.Pin = GPIO_PIN_2 | GPIO_PIN_3;
10 | gpio_init.Mode = GPIO_MODE_AF_PP;
11 | gpio_init.Pull = GPIO_NOPULL;
12 | gpio_init.Alternate = GPIO_AF7_USART2;
13 |
14 | HAL_GPIO_Init(GPIOA , &gpio_init);
15 |
16 | HAL_NVIC_EnableIRQ(USART2_IRQn);
17 |
18 | HAL_NVIC_SetPriority(USART2_IRQn, 15, 0);
19 | }
20 | void HAL_MspInit(void)
21 | {
22 | NVIC_SetPriorityGrouping( 0 );
23 | }
24 |
--------------------------------------------------------------------------------
/Queue_Create/src/syscalls.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rabie45/FreeRTOS-tutorial-stm32/fe187489d05e420f8ab6c641fe68d4458ccdc8fa/Queue_Create/src/syscalls.c
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FreeRTOS-tutorial-stm32
2 | 💡 this tutorial contain a simple explanation for FreeRTOS using neculo-32f303RE
3 |
4 | **⭐️Tutorials⭐️**
5 |
6 | - [x] FreeRTOS-Template
7 |
8 | - [x] Create-Task-Tutorial
9 |
10 | - [x] Notfiy
11 |
12 | - [x] Delete-Task
13 |
14 | - [x] Queue mangment
15 |
16 | - [x] Semaphore
17 |
18 | - [ ] Mutex
19 |
20 |
21 |
22 | __# For support make star ⭐️__
23 |
--------------------------------------------------------------------------------