XILNIXSDK2018为FreeRTOS增加配置项的方法

在安装目录下找到目录:

SDK\2018.1\data\embeddedsw\ThirdParty\bsp\freertos10_xilinx_v1_0\data

然后通过两个步骤来完成配置项的增加。

(1) 编辑文件freertos10_xilinx.mld,为配置界面增加项目

用文本编辑器打开freertos10_xilinx.mld文件,通过手动编辑文件添加配置项

如想添加FreeRTOSconfigSUPPORT_STATIC_ALLOCATION配置,采取如下步骤:

1. 为这个配置项取一个适当的名字(不冲突),这里取为support_static_allocation

2. 设置好类型,这里为bool,缺省值,描述(随便看得明白即可)等

3. 找一个行当的分组,这里选kernel_behavior类别

BEGIN CATEGORY kernel_behavior

4. 在选中的类别里添加一行,这里为

PARAM name = support_static_allocation, type = bool, default = false, desc = "Support static allocation memory for FreeRTOS objects.";

添加后变成:

BEGIN CATEGORY kernel_behavior

PARAM name = kernel_behavior, type = bool, default = true, desc = "Parameters relating to the kernel behavior", permit = none;

PARAM name = max_api_call_interrupt_priority, type = int, default = 18, desc = "The maximum interrupt priority from which interrupt safe FreeRTOS API calls can be made.";

PARAM name = use_preemption, type = bool, default = true, desc = "Set to true to use the preemptive scheduler, or false to use the cooperative scheduler.";

PARAM name = tick_rate, type = int, default = 100, desc = "Number of RTOS ticks per sec";

PARAM name = idle_yield, type = bool, default = true, desc = "Set to true if the Idle task should yield if another idle priority task is able to run, or false if the idle task should always use its entire time slice unless it is preempted.";

PARAM name = max_priorities, type = int, default = 8, desc = "The number of task priorities that will be available.  Priorities can be assigned from zero to (max_priorities - 1)";

PARAM name = minimal_stack_size, type = int, default = 200, desc = "The size of the stack allocated to the Idle task. Also used by standard demo and test tasks found in the main FreeRTOS download.";

PARAM name = total_heap_size, type = int, default = 65536, desc = "Sets the amount of RAM reserved for use by FreeRTOS - used when tasks, queues, semaphores and event groups are created.";

PARAM name = max_task_name_len, type = int, default = 10, desc = "The maximum number of characters that can be in the name of a task.";

PARAM name = use_timeslicing, type = bool, default = true, desc = "When true equal priority ready tasks will share CPU time with a context switch on each tick interrupt.";

PARAM name = use_port_optimized_task_selection, type = bool, default = true, desc ="When true task selection will be faster at the cost of limiting the maximum number of unique priorities to 32.";

PARAM name = support_static_allocation, type = bool, default = false, desc = "Support static allocation memory for FreeRTOS objects.";

END CATEGORY

(2) 编辑文件freertos10_xilinx.tcl,为最后生成的配置文件增加项目

用文本编辑器打开freertos10_xilinx.tcl文件,通过手动编辑文件添加配置项

如想添加FreeRTOSconfigSUPPORT_STATIC_ALLOCATION配置,采取如下步骤:

1. 找到文件中下面的内容:

############################################################################

## Add constants common to all architectures to the configuration file.

############################################################################

set config_file [xopen_new_include_file "./src/FreeRTOSConfig.h" "FreeRTOS Configuration parameters"]

puts $config_file "\#include \"xparameters.h\" \n"

2. 添加几行内容:

set val [common::get_property CONFIG.support_static_allocation $os_handle]

if {$val == "false"} {

xput_define $config_file "configSUPPORT_STATIC_ALLOCATION" "0"

} else {

xput_define $config_file "configSUPPORT_STATIC_ALLOCATION" "1"

}

注意上面的support_static_allocation是第一步为configSUPPORT_STATIC_ALLOCATION取的名字。

 

保存文件,重启SDK,打开BSP settings界面

 

 

然后可以看到界面上增加了配置选项:

 

配置完成后,重新生成BSP代码:

然后查看配置文件:

可以看到,在BSPFreeRTOSConfig.h文件中增加了一行:

#define configSUPPORT_STATIC_ALLOCATION 1

 

 

猜你喜欢

转载自blog.csdn.net/lyqdy/article/details/79941423