This page provides information related to the Versal Platform Loader and Manager (PLM).
...
Info |
---|
Note: CRC can be enabled for IPI messages by setting ENABLE_IPI_CRC_VAL to 1U in xipisu.h file. This will add CRC validation check for IPI to/from communication. Please note that this setting need to be done in all application libraries for the Versal boot and post boot to work without any issues. |
Scheduler
Scheduler is a simple timer-based functionality to support execution of periodic/non-periodic tasks. A schedule is required by modules such as XilSEM to support periodic tasks such as SEU detection scan operations.
Adding a task to scheduler
...
Task Modeling in PLM
PLM provides a very simple run-to-completion time-limited priority task loop model to get real-time behavior. This means that the main program is a simple loop that looks up the next task (typically a pointer to a function to be executed with a corresponding context data structure) from a queue of tasks and calls the function (executes the task) with the context as a parameter. Any interrupt that occur while the task is running, will obviously interrupt the execution, but since you are only allowed to do extremely simple things at interrupt level (i.e., disable interrupt and add a new task to the task queue), the task is logically executed in one chunk.
The complexity with the run-to-completion model comes when a particular task needs to run longer. If that happens, the task needs to be split into multiple events. There are three priority task queues, with Critical, High and Normal priority, Task dispatcher will check the priority queues in order and execute the Critical priority task handlers first. After executing task handler, dispatcher will check the task queues again and execute the next handler. If there are multiple tasks present in same queue, tasks will be executed one by one. All the tasks run to completion till task handler returns (i.e., there is no preemption). With no preemption, there will not be any need for locks and synchronization issues. Once the task is completed, it will be removed from the queue.
The priority order of the tasks are as below:
Critical priority tasks (
XPLM_TASK_PRIORITY_CRITICAL
)High Priority tasks (
XPLM_TASK_PRIORITY_0
)Normal Priority tasks (
XPLM_TASK_PRIORITY_1
)
The general specifications for each PLM module are
Run nothing in interrupt context; instead, add the necessary priority task to the task queue.
To allow PLM to move on to the next high-priority task, the running task must not take longer time.
No task should obstruct resources such as DMAs or CFI for longer duration.
Since PLM supports three priority tasks (Critical, High and Normal priority), below example shows how the user can create a high priority task within PLM
Code Block | ||
---|---|---|
| ||
int XPlm_PreBootTasks(void* Arg)
{
XPlmi_Printf(DEBUG_PRINT_ALWAYS, "User task handler\r\n");
return XST_SUCCESS;
}
int XPlmi_RegisterUserTask(void)
{
int Status = XST_FAILURE;
XPlmi_TaskNode *Task;
Task = XPlmi_TaskCreate(XPLM_TASK_PRIORITY_0, UserTaskHandler, NULL);
if (Task == NULL) {
Status = XPlmi_UpdateStatus(XPLM_ERR_TASK_CREATE, 0);
}
return Status;
} |
In the above example code, XPLM_TASK_PRIORITY_0
is passed to the XPlmi_TaskCreate function along with the task handler to create a task with high priority. Similarly, If user wants to create a Normal priority task, XPLM_TASK_PRIORITY_1
needs to be passed as priority argument for XPlmi_TaskCreate function.
Scheduler
Scheduler is a simple timer-based functionality to support execution of periodic/non-periodic tasks. A scheduler is required by modules such as XilSEM to support periodic tasks such as SEU detection scan operations. Scheduler also supports Critical, High and Normal priority tasks. The Critical priority tasks are given priority over High and Normal priority tasks.
Adding a task to scheduler
Tasks are functions which take void args and return the state of the task handler. Currently, PLM has no way to check that the task returns in a pre-determined time, so this needs to be ensured by the task design. Let us consider a task which prints out a message:
...
Code Block | ||
---|---|---|
| ||
Status = XPlmi_SchedulerAddTask(OWNER_ID, XPlmi_TaskPrintMsg,
NULL, 100U, XPLM_TASK_PRIORITY_0, NULL,
XPLMI_PERIODIC_TASK);
if (XST_SUCCESS != Status) {
//Update proper error code to the Status variable.
} |
...
*This above size which we give here is basically the total Image store memory allocated where multiple PDI’s are stored once the PDI add request is made.
Eg:
A new <PDI ID> field is added to the Add & Remove Image Store IPI command
...
id_code = 0x14ca8093
extended_id_code = 0x01
id = 0x1
boot_device { imagestore, address = 12 }
image
{
name = pmc_subsys
id = 0x1c000001
partition
{
id = 0x2
type = bootloader
file = ./plm.elf
}
partition
{
id = 0x3
type = pmcdata,load=0xF2000000
file = ./pmc_data.cdo
}
}
...
Info |
---|
Note: All of the metrics are with compilation optimized for size (-Os) and LTO settings enabled for PLM BSP. This optimization settings are enabled by default. |
[2022.2]
S No. | Feature/Build Flag | Size occupied (KB) | Free space (KB) | Additional Notes | Remarks |
---|---|---|---|---|---|
1 | PLM default build | 363.6 | 20.4 | Default PLM includes all PLM modules and basic PLM prints, and has time stamp enabled. (PLM_DEBUG and PLM_PRINT_PERF) | |
2 | PLM_PRINT_NO_UART enabled/plm_uart_dbg_en set to false | 363.6 | 20.4 | Disables prints to UART (Print to memory is enabled irrespective of this option being set) | This estimate is with the combination of (1) and (2) |
3 | PLM_PRINT enabled/plm_dbg_lvl set to level 0 | 331.9 | 52.1 | Enables only mandatory prints | This estimate is with PLM_PRINT macro enabled and all other print macros (PLM_DEBUG, PLM_DEBUG_INFO and PLM_DEBUG_DETAILED) disabled |
4 | PLM_DEBUG_INFO enabled/plm_dbg_lvl set to level 2 | 376.6 | 7.4 | Enables more info prints | This estimate is with PLM_DEBUG_INFO macro enabled and all other print macros (PLM_PRINT, PLM_DEBUG and PLM_DEBUG_DETAILED) disabled |
5 | PLM_DEBUG_DETAILED enabled/plm_dbg_lvl set to level 3 | Overflowed by 1480 bytes | - | Enables detailed debug prints | This estimate is with PLM_DEBUG_DETAILED macro enabled and all other print macros (PLM_PRINT, PLM_DEBUG and PLM_DEBUG_INFO) disabled |
6 | PLM_DEBUG_MODE enabled/plm_mode set to debug | 362.8 | 21.2 | PLM debug mode is enabled when PLM_DEBUG_MODE flag is enabled or plm_mode option is set to debug | This estimate is with the combination of (1) and (6) |
7 | PLM_PRINT_PERF disabled/plm_perf_en set to false | 363.3 | 20.7 | Disables PLM performance prints | This estimate is with the combination of (1) and (7) |
8 | PLM_QSPI_EXCLUDE enabled/plm_qspi_en set to false | 355.5 | 28.5 | Excludes QSPI related code | This estimate is with the combination of (1) and (8) |
9 | PLM_SD_EXCLUDE enabled/plm_sd_en set to false | 343.3 | 40.7 | Excludes SD related code | This estimate is with the combination of (1) and (9) |
10 | PLM_OSPI_EXCLUDE enabled/plm_ospi_en set to false | 363.6 | 20.4 | Excludes OSPI related code | This estimate is with the combination of (1) and (10) |
11 | PLM_SEM_EXCLUDE enabled/plm_sem_en set to false | 363.6 | 20.4 | Excludes SEM related code | This estimate is with the combination of (1) and (11) |
12 | PLM_SECURE_EXCLUDE enabled/plm_secure_en set to false | 317.5 | 66.5 | Excludes Secure related code | This estimate is with the combination of (1) and (12) |
13 | PLM_USB_EXCLUDE disabled/plm_usb_en set to true | 374.1 | 9.9 | Enables USB related code | This estimate is with the combination of (1) and (13) |
14 | PLM_NVM_EXCLUDE disabled/plm_nvm_en set to true | Overflowed by 232 bytes | - | Enables NVM related code | This estimate is with the combination of (1) and (14) |
15 | PLM_PUF_EXCLUDE disabled/plm_puf_en set to true | 366.5 | 17.5 | Enabled PUF related code | This estimate is with the combination of (1) and (15) |
[2023.1]
S No. | Feature/Build Flag | Size occupied (KB) | Free space (KB) | Additional Notes | Remarks |
1 | PLM default build | 376.35 | 7.65 | Default PLM includes all PLM modules and basic PLM prints, and has time stamp enabled. (PLM_DEBUG and PLM_PRINT_PERF) | |
2 | PLM_PRINT_NO_UART enabled/plm_uart_dbg_en set to false | 376.35 | 7.65 | Disables prints to UART (Print to memory is enabled irrespective of this option being set) | This estimate is with the combination of (1) and (2) |
3 | PLM_PRINT enabled/plm_dbg_lvl set to level 0 | 342.23 | 41.77 | Enables only mandatory prints | This estimate is with PLM_PRINT macro enabled and all other print macros (PLM_DEBUG, PLM_DEBUG_INFO and PLM_DEBUG_DETAILED) disabled |
4 | PLM_DEBUG_INFO enabled/plm_dbg_lvl set to level 2 | Overflowed by 7664 bytes | - | Enables more info prints | This estimate is with PLM_DEBUG_INFO macro enabled and all other print macros (PLM_PRINT, PLM_DEBUG and PLM_DEBUG_DETAILED) disabled |
5 | PLM_DEBUG_DETAILED enabled/plm_dbg_lvl set to level 3 | Overflowed by 16880 bytes | - | Enables detailed debug prints | This estimate is with PLM_DEBUG_DETAILED macro enabled and all other print macros (PLM_PRINT, PLM_DEBUG and PLM_DEBUG_INFO) disabled |
6 | PLM_DEBUG_MODE enabled/plm_mode set to debug | 374.46 | 9.54 | PLM debug mode is enabled when PLM_DEBUG_MODE flag is enabled or plm_mode option is set to debug | This estimate is with the combination of (1) and (6) |
7 | PLM_PRINT_PERF disabled/plm_perf_en set to false | 376.15 | 7.85 | Disables PLM performance prints | This estimate is with the combination of (1) and (7) |
8 | PLM_QSPI_EXCLUDE enabled/plm_qspi_en set to false | 367.21 | 16.79 | Excludes QSPI related code | This estimate is with the combination of (1) and (8) |
9 | PLM_SD_EXCLUDE enabled/plm_sd_en set to false | 353.46 | 30.54 | Excludes SD related code | This estimate is with the combination of (1) and (9) |
10 | PLM_OSPI_EXCLUDE enabled/plm_ospi_en set to false | 376.35 | 7.65 | Excludes OSPI related code | This estimate is with the combination of (1) and (10) |
11 | PLM_SEM_EXCLUDE enabled/plm_sem_en set to false | 376.35 | 7.65 | Excludes SEM related code | This estimate is with the combination of (1) and (11) |
12 | PLM_SECURE_EXCLUDE enabled/plm_secure_en set to false | 324.36 | 59.64 | Excludes Secure related code | This estimate is with the combination of (1) and (12) |
13 | PLM_USB_EXCLUDE disabled/plm_usb_en set to true | Overflowed by 3088 bytes | - | Enables USB related code | This estimate is with the combination of (1) and (13) |
14 | PLM_NVM_EXCLUDE disabled/plm_nvm_en set to true | Overflowed by 12872 bytes | - | Enables NVM related code | This estimate is with the combination of (1) and (14) |
15 | PLM_PUF_EXCLUDE disabled/plm_puf_en set to true | 378.89 | 5.11 | Enabled PUF related code | This estimate is with the combination of (1) and (15) |
16 | PLM_ECDSA_EXCLUDE enabled/plm_ecdsa_en set to false | 361.5 | 22.5 | Excludes ECDSA related code | This estimate is with the combination of (1) and (16) |
17 | PLM_RSA_EXCLUDE enabled/plm_rsa_en set to false | 368.5 | 15.5 | Excludes RSA related code | This estimate is with the combination of (1) and (17) |
18 | PLM_ENABLE_PLM_TO_PLM_COMM disabled/ssit_plm_to_plm_comm_en set to false | 376.35 | 7.65 | Excludes PLM to PLM communication related code | This estimate is with the combination of (1) and (18) |
...
clean:
rm -rf $(LIBPLMI_DIR)/${OBJECTS}
rm -rf ${RELEASEDIR}/${LIB}
$(LIBPLMI_DIR)/xplmi.o: $(LIBPLMI_DIR)/xplmi.c $(INCLUDEFILES)
$(COMPILER) $(COMPILER_FLAGS) -g -ffunction-sections -fdata-sections -Wall -Wextra -Og $(INCLUDES) -c $< -o $@
$(LIBPLMI_DIR)/%.o: $(LIBPLMI_DIR)/%.c $(INCLUDEFILES)
$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) -c $< -o $@
...
plm log -log-mem-addr 0x10A019000 -log-size 0x1000 → SLR1 / Slave 0
plm log -log-mem-addr 0x112019000 -log-size 0x1000 → SLR2/ Slave 1
plm log -log-mem-addr 0x11A019000 -log-size 0x1000 → SLR3/ Slave 2
*log-size (Max: 0x4000)
error_status / jtag_status for Secondary SLR / Slave SLR
...