基于模块分类和符号export 对 Freertos 代码整体解读

链接
可用的架构
ARMv7

armv7
	cortex-m
		架构支持		: FreeRTOS/Source/portable/GCC/ARM_CM3
		BSP Demo	: Demo/CORTEX_M3_MPS2_QEMU_GCC
	cortex-a
		架构支持		: FreeRTOS/Source/portable/GCC/ARM_CA9
		BSP Demo	: Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU
ARMv8
armv8
	cortex-m
		架构支持		: FreeRTOS/Source/portable/ARMv8M
		BSP Demo	: Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC
	cortex-a
		架构支持		: Source/portable/GCC/ARM_CA53_64_BIT
		BSP Demo	: Demo/CORTEX_A53_64-bit_UltraScale_MPSoC

RISC V 32
RISC V32
	架构支持	 		: Source/portable/GCC/RISC-V
	BSP Demo 		: Demo/RISC-V-Qemu-virt_GCC
RISC V 64
RISC V64
	架构支持			: Source/portable/GCC/RISC-V
	BSP Demo		: Demo/RISC-V64-Qemu-virt_GCC // https://github.com/lisider/FreeRTOS/tree/RISC-V64-Qemu-virt_GCC/FreeRTOS/Demo/RISC-V64-Qemu-virt_GCC
目录架构 : 以 RISC-V-Qemu-virt_GCC为例
代码分类
bsp 代码及用户代码 					// 平台相关
	Demo/RISC-V-Qemu-virt_GCC

架构代码								// 架构相关
	Source/portable/GCC/RISC-V

内核代码								// 平台,架构无关
	Source/portable/MemMang
	Source/*.c
	Source/include/*.h

BSP 代码及用户代码
完成 boot(这就是BSP的含义) 及 main 函数内的功能
main 函数内 会设计到 设备的初始化(这就是BSP的含义)

向外输出以下符号
configASSERT
configASSERT_DEFINED
configCHECK_FOR_STACK_OVERFLOW
configCPU_CLOCK_HZ
configGENERATE_RUN_TIME_STATS
configIDLE_SHOULD_YIELD
configISR_STACK_SIZE_WORDS
configMAX_CO_ROUTINE_PRIORITIES
configMAX_PRIORITIES
configMAX_TASK_NAME_LEN
configMINIMAL_STACK_SIZE
configMTIME_BASE_ADDRESS
configMTIMECMP_BASE_ADDRESS
configQUEUE_REGISTRY_SIZE
configTICK_RATE_HZ
configTIMER_QUEUE_LENGTH
configTIMER_TASK_PRIORITY
configTIMER_TASK_STACK_DEPTH
configTOTAL_HEAP_SIZE
configUSE_16_BIT_TICKS
configUSE_APPLICATION_TASK_TAG
configUSE_CO_ROUTINES
configUSE_COUNTING_SEMAPHORES
configUSE_IDLE_HOOK
configUSE_MALLOC_FAILED_HOOK
configUSE_MUTEXES
configUSE_PORT_OPTIMISED_TASK_SELECTION
configUSE_PREEMPTION
configUSE_RECURSIVE_MUTEXES
configUSE_TICK_HOOK
configUSE_TIMERS
configUSE_TRACE_FACILITY
INCLUDE_eTaskGetState
INCLUDE_uxTaskPriorityGet
INCLUDE_vTaskDelay
INCLUDE_vTaskDelayUntil
INCLUDE_vTaskDelete
INCLUDE_vTaskPrioritySet
INCLUDE_vTaskSuspend
INCLUDE_xSemaphoreGetMutexHolder
INCLUDE_xTaskAbortDelay
INCLUDE_xTaskGetHandle
INCLUDE_xTimerPendFunctionCall
---- // 以上都是 Demo/RISC-V-Qemu-virt_GCC/FreeRTOSConfig.h 的符号
---- // 以下都是 Demo/RISC-V-Qemu-virt_GCC/main.c 的符号
vApplicationIdleHook
vApplicationMallocFailedHook
vApplicationStackOverflowHook
vApplicationTickHook
架构代码
Source/portable/GCC向外(内核代码,用户代码)输出了这些符号
BaseType_t
configUSE_PORT_OPTIMISED_TASK_SELECTION
portBYTE_ALIGNMENT
portCLEAR_INTERRUPT_MASK_FROM_ISR
portCRITICAL_NESTING_IN_TCB
portDISABLE_INTERRUPTS
portENABLE_INTERRUPTS
portENTER_CRITICAL
portEXIT_CRITICAL
portGET_HIGHEST_PRIORITY
portMAX_DELAY
portMEMORY_BARRIER
portPOINTER_SIZE_TYPE
portRECORD_READY_PRIORITY
portRESET_READY_PRIORITY
portSET_INTERRUPT_MASK_FROM_ISR
portSTACK_GROWTH
portTASK_FUNCTION_PROTO
portTICK_PERIOD_MS
portTICK_TYPE_IS_ATOMIC
portYIELD
pxPortInitialiseStack
StackType_t
TickType_t
UBaseType_t
vPortEndScheduler
xPortStartScheduler
内核代码
(用户代码和BSP代码)输出这些符号
configASSERT
configASSERT_DEFINED
configCHECK_FOR_STACK_OVERFLOW
configUSE_PORT_OPTIMISED_TASK_SELECTION
eBlocked
eIncrement
eNoAction
eReady
errQUEUE_EMPTY
errQUEUE_FULL
eSetBits
eSetValueWithoutOverwrite
eSetValueWithOverwrite
eSuspended
eTaskGetState
EventBits_t
EventGroupHandle_t
INCLUDE_eTaskGetState
INCLUDE_uxTaskPriorityGet
pcTaskGetName
pcTimerGetName
pdFAIL
pdFALSE
pdMS_TO_TICKS
pdPASS
pdTRUE
portBYTE_ALIGNMENT_MASK
pvTimerGetTimerID
QueueHandle_t
SemaphoreHandle_t
taskDISABLE_INTERRUPTS
taskENTER_CRITICAL
taskEXIT_CRITICAL
TaskHandle_t
taskYIELD
TimerHandle_t
tskIDLE_PRIORITY
ulTaskNotifyTake
ulTaskNotifyValueClear
uxTaskPriorityGet
uxTimerGetReloadMode
vEventGroupDelete
vQueueAddToRegistry
vTaskDelay
vTaskDelayUntil
vTaskNotifyGiveFromISR
vTaskPrioritySet
vTaskResume
vTaskStartScheduler
vTaskSuspend
vTaskSuspendAll
vTaskSwitchContext
vTimerSetReloadMode
vTimerSetTimerID
xEventGroupClearBits
xEventGroupClearBitsFromISR
xEventGroupCreate
xEventGroupGetBits
xEventGroupGetBitsFromISR
xEventGroupSetBits
xEventGroupSetBitsFromISR
xEventGroupSync
xEventGroupWaitBits
xQueueCreate
xQueueReceive
xQueueSend
xSemaphoreCreateRecursiveMutex
xSemaphoreGiveRecursive
xSemaphoreTakeRecursive
xTaskCatchUpTicks
xTaskCreate
xTaskDelayUntil
xTaskGetCurrentTaskHandle
xTaskGetTickCount
xTaskNotify
xTaskNotifyAndQuery
xTaskNotifyAndQueryFromISR
xTaskNotifyFromISR
xTaskNotifyGive
xTaskNotifyStateClear
xTaskNotifyWait
xTaskResumeAll
xTimerChangePeriod
xTimerChangePeriodFromISR
xTimerCreate
xTimerDelete
xTimerIsTimerActive
xTimerReset
xTimerResetFromISR
xTimerStart
xTimerStartFromISR
xTimerStop
xTimerStopFromISR
现有的BSP支持
2022-7-8 23:42:52
是否可以在 QEMU 仿真
是否可以仿真,要看 QEMU 是否支持 这个 bsp
应该是没有 freertos 支持 qemu 这种说法.
但是 qemu 有一个 完全虚拟的板子. 即 virt
freertos 支持 	qemu-rv32/64-virt
freertos 不支持 qemu-arm32/64-virt

FreeRTOS/FreeRTOS/Demo$ ls | egrep  "QEMU|Qemu"
CORTEX_A9_Zynq_ZC702_Vitis_QEMU
CORTEX_LM3S6965_GCC_QEMU
CORTEX_M3_MPS2_QEMU_GCC
CORTEX_MPS2_QEMU_IAR_GCC
CORTEX_MPU_M3_MPS2_QEMU_GCC
RISC-V64-Qemu-virt_GCC
RISC-V-Qemu-sifive_e-Eclipse-GCC
RISC-V-Qemu-virt_GCC
RISC-V_RV32_QEMU_VIRT_GCC
整体
FreeRTOS/Demo/<project_name>
FreeRTOS/Source/portable/<compiler>/<architecture>

FreeRTOS
├── Demo 			// bsp 支持
│   ├── CORTEX_A9_Zynq_ZC702_Vitis_QEMU
│   ├── CORTEX_LM3S6965_GCC_QEMU
│   ├── CORTEX_M3_MPS2_QEMU_GCC
│   ├── CORTEX_MPS2_QEMU_IAR_GCC
│   ├── CORTEX_MPU_M3_MPS2_QEMU_GCC
│   ├── RISC-V-Qemu-virt_GCC
│   └── Xilinx_FreeRTOS_BSP
└── Source
    └── portable
	   └── GCC 			// 编译器支持
	   	   ├── ARM_CA53_64_BIT 		// 架构支持
	   	   ├── ARM_CA53_64_BIT_SRE
	   	   ├── ARM_CA9
	   	   ├── ARM_CM0
	   	   ├── ARM_CM23
	   	   ├── ARM_CM23_NTZ
	   	   ├── ARM_CM3
	   	   ├── ARM_CM33
	   	   ├── ARM_CM33_NTZ
	   	   ├── ARM_CM3_MPU
	   	   ├── ARM_CM4F
	   	   ├── ARM_CM4_MPU
	   	   ├── ARM_CM7
	   	   ├── ARM_CR5
	   	   ├── ARM_CRx_No_GIC
	   	   └── RISC-V
编译器支持
$ tree FreeRTOS/Source/portable/ -L 1
FreeRTOS/Source/portable/
├── ARMClang
├── ARMv8M
├── BCC
├── CCS
├── CMakeLists.txt
├── CodeWarrior
├── Common
├── GCC
├── IAR
├── Keil
├── MemMang
├── MikroC
├── MPLAB
├── MSVC-MingW
├── oWatcom
├── Paradigm
├── readme.txt
├── Renesas
├── Rowley
├── RVDS
├── SDCC
├── Softune
├── Tasking
├── ThirdParty
└── WizC

23 directories, 2 files
GCC下的硬件架构支持
FreeRTOS will run on any Cortex-M 
(0, 0+, 3, 4, 4F, and 7) that has enough RAM

$ tree FreeRTOS/Source/portable/GCC -L 1
FreeRTOS/Source/portable/GCC
├── ARM7_AT91FR40008
├── ARM7_AT91SAM7S
├── ARM7_LPC2000
├── ARM7_LPC23xx
├── ARM_CA53_64_BIT
├── ARM_CA53_64_BIT_SRE
├── ARM_CA9
├── ARM_CM0
├── ARM_CM23
├── ARM_CM23_NTZ
├── ARM_CM3
├── ARM_CM33
├── ARM_CM33_NTZ
├── ARM_CM3_MPU
├── ARM_CM4F
├── ARM_CM4_MPU
├── ARM_CM7
├── ARM_CR5
├── ARM_CRx_No_GIC
├── ATMega323
├── AVR32_UC3
├── AVR_AVRDx
├── AVR_Mega0
├── ColdFire_V2
├── CORTUS_APS3
├── H8S2329
├── HCS12
├── IA32_flat
├── MCF5235
├── MicroBlaze
├── MicroBlazeV8
├── MicroBlazeV9
├── MSP430F449
├── NiosII
├── PPC405_Xilinx
├── PPC440_Xilinx
├── RISC-V
├── RL78
├── RX100
├── RX200
├── RX600
├── RX600v2
├── RX700v3_DPFPU
├── STR75x
└── TriCore_1782

45 directories, 0 files

板级支持

$ tree FreeRTOS/Demo/ -L 1 |egrep "CORTEX|RISC-V"
├── CORTEX_A2F200_IAR_and_Keil
├── CORTEX_A2F200_SoftConsole
├── CORTEX_A53_64-bit_UltraScale_MPSoC
├── CORTEX_A5_SAMA5D2x_Xplained_IAR
├── CORTEX_A5_SAMA5D3x_Xplained_IAR
├── CORTEX_A5_SAMA5D4x_EK_IAR
├── CORTEX_A9_Cyclone_V_SoC_DK
├── CORTEX_A9_RZ_R7S72100_IAR_DS-5
├── CORTEX_A9_Zynq_ZC702
├── CORTEX_A9_Zynq_ZC702_Vitis_QEMU
├── CORTEX_AT91SAM3U256_IAR
├── CORTEX_ATSAM3S-EK2_Atmel_Studio
├── CORTEX_ATSAM3X_Atmel_Studio
├── CORTEX_CY8C5588_PSoC_Creator_GCC
├── CORTEX_CY8C5588_PSoC_Creator_Keil
├── CORTEX_CY8C5588_PSoC_Creator_RVDS
├── CORTEX_EFM32_Giant_Gecko_Simplicity_Studio
├── CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio
├── CORTEX_EFMG890F128_IAR
├── CORTEX_Kinetis_K60_Tower_IAR
├── CORTEX_LM3S102_GCC
├── CORTEX_LM3S102_Rowley
├── CORTEX_LM3S316_IAR
├── CORTEX_LM3S6965_GCC_QEMU
├── CORTEX_LM3S811_GCC
├── CORTEX_LM3S811_IAR
├── CORTEX_LM3S811_KEIL
├── CORTEX_LM3Sxxxx_Eclipse
├── CORTEX_LM3Sxxxx_IAR_Keil
├── CORTEX_LM3Sxxxx_Rowley
├── CORTEX_LPC1768_GCC_RedSuite
├── CORTEX_LPC1768_GCC_Rowley
├── CORTEX_LPC1768_IAR
├── CORTEX_M0+_Atmel_SAMD20_XPlained
├── CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC
├── CORTEX_M0_LPC1114_LPCXpresso
├── CORTEX_M0+_LPC51U68_GCC_IAR_KEIL
├── CORTEX_M0+_NUCLEO_L010RB_GCC_IAR
├── CORTEX_M0_STM32F0518_IAR
├── CORTEX_M3_MPS2_QEMU_GCC
├── CORTEX_M4_ATSAM4L_Atmel_Studio
├── CORTEX_M4_ATSAM4S_Atmel_Studio
├── CORTEX_M4F_ATSAM4E_Atmel_Studio
├── CORTEX_M4F_CEC1302_Keil_GCC
├── CORTEX_M4F_CEC1302_MikroC
├── CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC
├── CORTEX_M4F_Infineon_XMC4000_GCC_Dave
├── CORTEX_M4F_Infineon_XMC4000_IAR
├── CORTEX_M4F_Infineon_XMC4000_Keil
├── CORTEX_M4F_Infineon_XMC4000_Tasking
├── CORTEX_M4F_Infineon_XMC4500_GCC_Atollic
├── CORTEX_M4F_M0_LPC43xx_Keil
├── CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil
├── CORTEX_M4F_STM32F407ZG-SK
├── CORTEX_M4_SimpleLink_CC3220SF_CCS
├── CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR
├── CORTEX_M7_SAME70_Xplained_AtmelStudio
├── CORTEX_M7_SAMV71_Xplained_AtmelStudio
├── CORTEX_M7_SAMV71_Xplained_IAR_Keil
├── CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil
├── CORTEX_MB9A310_IAR_Keil
├── CORTEX_MB9B500_IAR_Keil
├── CORTEX_MPS2_QEMU_IAR_GCC
├── CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC
├── CORTEX_MPU_LM3Sxxxx_Rowley
├── CORTEX_MPU_LPC1768_GCC_RedSuite
├── CORTEX_MPU_LPC54018_MCUXpresso
├── CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC
├── CORTEX_MPU_M33F_Nordic_NRF9160_SES
├── CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES
├── CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso
├── CORTEX_MPU_M33F_Simulator_Keil_GCC
├── CORTEX_MPU_M3_MPS2_QEMU_GCC
├── CORTEX_MPU_M3_NUCLEO_L152RE_GCC
├── CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil
├── CORTEX_MPU_Simulator_Keil_GCC
├── CORTEX_MPU_Static_Simulator_Keil_GCC
├── CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil
├── CORTEX_R4F_RZ_T_GCC_IAR
├── CORTEX_R4_RM48_TMS570_CCS5
├── CORTEX_R5_UltraScale_MPSoC
├── CORTEX_SmartFusion2_M2S050_SoftConsole
├── CORTEX_STM32F100_Atollic
├── CORTEX_STM32F103_GCC_Rowley
├── CORTEX_STM32F103_IAR
├── CORTEX_STM32F103_Keil
├── CORTEX_STM32F103_Primer_GCC
├── CORTEX_STM32F107_GCC_Rowley
├── CORTEX_STM32L152_Discovery_IAR
├── CORTEX_STM32L152_IAR
├── RISC-V64-Qemu-virt_GCC
├── RISC-V-Qemu-sifive_e-Eclipse-GCC
├── RISC-V-Qemu-virt_GCC
├── RISC-V_Renode_Emulator_SoftConsole
├── RISC-V_RV32M1_Vega_GCC_Eclipse
├── RISC-V_RV32_QEMU_VIRT_GCC
├── RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio
├── RISC-V_RV32_SiFive_HiFive1-RevB_IAR
├── RISC-V_RV64_PolarFire_SoftConsole
├── RISC-V-spike-htif_GCC
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值