Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
I'm getting this error while building a binary with IPC,I2C,GPIO and SPI enabled :
[ 297.873902] remoteproc remoteproc0: powering up 5000000.m4fss [ 297.889147] remoteproc remoteproc0: Booting fw image am62-mcu-m4f0_0-fw, size 71480 [ 297.901798] remoteproc remoteproc0: bad phdr da 0x30000 mem 0x11f80 [ 297.913478] remoteproc remoteproc0: Failed to load program segments: -22 [ 297.920853] remoteproc remoteproc0: Boot failed: -22 -sh: echo: write error: Invalid argument
As far as I'm concerned,it indicates an error occurred while loading the firmware image. phdr
refers to a program header, which is a data structure that describes the layout of the firmware image in memory. The error message suggests that there is a mismatch between the expected memory address (da 0x30000
) and the actual memory address (mem 0x11f80
) of the program header. Here's my linker.cmd file,which I had modified(the heap and M4F DRAM's lenght):
/* make sure below retain is there in your linker command file, it keeps the vector table in the final binary */ --retain="*(.vectors)" /* This is the stack that is used by code running within main()` * In case of NORTOS, * - This means all the code outside of ISR uses this stack * In case of FreeRTOS * - This means all the code until vTaskStartScheduler() is called in main() * uses this stack. * - After vTaskStartScheduler() each task created in FreeRTOS has its own stack */ --stack_size=16384 /* This is the heap size for malloc() API in NORTOS and FreeRTOS * This is also the heap used by pvPortMalloc in FreeRTOS */ --heap_size=65536 SECTIONS { /* This has the M4F entry point and vector table, this MUST be at 0x0 */ .vectors:{} palign(8) > M4F_VECS .text: {} palign(8) > M4F_IRAM /* This is where code resides */ .bss: {} palign(8) > M4F_DRAM /* This is where uninitialized globals go */ RUN_START(__BSS_START) RUN_END(__BSS_END) .data: {} palign(8) > M4F_DRAM /* This is where initialized globals and static go */ .rodata: {} palign(8) > M4F_DRAM /* This is where const's go */ .sysmem: {} palign(8) > M4F_IRAM /* This is where the malloc heap goes */ .stack: {} palign(8) > M4F_IRAM /* This is where the main() stack goes */ GROUP { /* This is the resource table used by linux to know where the IPC "VRINGs" are located */ .resource_table: {} palign(4096) } > DDR_IPC_RESOURCE_TABLE_LINUX /* Sections needed for C++ projects */ .ARM.exidx: {} palign(8) > M4F_IRAM /* Needed for C++ exception handling */ .init_array: {} palign(8) > M4F_IRAM /* Contains function pointers called before main */ .fini_array: {} palign(8) > M4F_IRAM /* Contains function pointers called after main */ /* this is used only when IPC RPMessage is enabled, else this is not used */ .bss.ipc_vring_mem (NOLOAD) : {} > DDR_IPC_VRING_RTOS } MEMORY { M4F_VECS : ORIGIN = 0x00000000 , LENGTH = 0x00000200 M4F_IRAM : ORIGIN = 0x00000200 , LENGTH = 0x0002FE00 M4F_DRAM : ORIGIN = 0x00030000 , LENGTH = 0x00015000 /* when using multi-core application's i.e more than one R5F/M4F active, make sure * this memory does not overlap with R5F's */ /* Resource table must be placed at the start of DDR_IPC_RESOURCE_TABLE_LINUX when M4 core is early booting with Linux */ DDR_IPC_RESOURCE_TABLE_LINUX : ORIGIN = 0x9CC00000 , LENGTH = 0x1000 DDR_IPC_VRING_RTOS: ORIGIN = 0x9C800000, LENGTH = 0x00300000 }
here's the main.c file:
#include <stdlib.h> #include <kernel/dpl/DebugP.h> #include "ti_drivers_config.h" #include "ti_board_config.h" #include "ti_drivers_open_close.h" #include "ti_board_open_close.h" #include "FreeRTOS.h" #include "task.h" #define MAIN_TASK_PRI (configMAX_PRIORITIES-1) #define MAIN_TASK_SIZE (16384U/sizeof(configSTACK_DEPTH_TYPE)) #define I2C_TASK_PRI (configMAX_PRIORITIES-2) #define I2C_TASK_SIZE (4096U/sizeof(configSTACK_DEPTH_TYPE)) #define GPIO_TASK_PRI (configMAX_PRIORITIES-3) #define GPIO_TASK_SIZE (1024U/sizeof(configSTACK_DEPTH_TYPE)) StackType_t gMainTaskStack[MAIN_TASK_SIZE] __attribute__((aligned(32))); StaticTask_t gMainTaskObj; TaskHandle_t gMainTask; StackType_t gI2CTaskStack[I2C_TASK_SIZE] __attribute__((aligned(32))); StaticTask_t gI2CTaskObj; TaskHandle_t gI2CTask; StackType_t gGPIOTaskStack[GPIO_TASK_SIZE] __attribute__((aligned(32))); StaticTask_t gGPIOTaskObj; TaskHandle_t gGPIOTask; void empty_main_i2c(void *arg0); void gpio_led_blink_main(void *args); void *empty_main_spi(void *arg0); StackType_t gMainTaskStack1[MAIN_TASK_SIZE] __attribute__((aligned(32))); StaticTask_t gMainTaskObj1; TaskHandle_t gMainTask1; void empty_main(void *args); void empty_main1(void *args){ int32_t status = SystemP_SUCCESS; /* Open drivers */ Drivers_open(); /* Open flash and board drivers */ status = Board_driversOpen(); DebugP_assert(status==SystemP_SUCCESS); empty_main(NULL); /* Close board and flash drivers */ Board_driversClose(); /* Close drivers */ Drivers_close(); vTaskDelete(NULL); } void freertos_main(void *args) { int32_t status = SystemP_SUCCESS; /* Open drivers */ Drivers_open(); /* Open flash and board drivers */ status = Board_driversOpen(); DebugP_assert(status == SystemP_SUCCESS); /* Create the hello world task */ gI2CTask = xTaskCreateStatic(empty_main_i2c, /* Pointer to the task function */ "empty_main_i2c", /* Task name for debugging */ I2C_TASK_SIZE, /* Stack size */ NULL, /* Task parameter */ I2C_TASK_PRI, /* Task priority */ gI2CTaskStack, /* Stack buffer */ &gI2CTaskObj); /* Task control block */ configASSERT(gI2CTask != NULL); /* Create the beautiful task */ gGPIOTask = xTaskCreateStatic(gpio_led_blink_main, /* Pointer to the task function */ "gpio_led_blink_main", /* Task name for debugging */ GPIO_TASK_SIZE,/* Stack size */ NULL, /* Task parameter */ GPIO_TASK_PRI, /* Task priority */ gGPIOTaskStack,/* Stack buffer */ &gGPIOTaskObj);/* Task control block */ configASSERT(gGPIOTask != NULL); empty_main_spi(NULL); /* Close board and flash drivers */ Board_driversClose(); /* Close drivers */ Drivers_close(); vTaskDelete(NULL); } int main() { /* init SOC specific modules */ System_init(); Board_init(); /* This task is created at highest priority, it should create more tasks and then delete itself */ gMainTask = xTaskCreateStatic(freertos_main, /* Pointer to the function that implements the task. */ "freertos_main", /* Task name for debugging */ MAIN_TASK_SIZE, /* Stack size */ NULL, /* Task parameter */ MAIN_TASK_PRI, /* Task priority */ gMainTaskStack, /* Stack buffer */ &gMainTaskObj); /* Task control block */ configASSERT(gMainTask != NULL); gMainTask = xTaskCreateStatic(empty_main1, /* Pointer to the function that implements the task. */ "empty_main", /* Task name for debugging */ MAIN_TASK_SIZE, /* Stack size */ NULL, /* Task parameter */ MAIN_TASK_PRI, /* Task priority */ gMainTaskStack1, /* Stack buffer */ &gMainTaskObj1); /* Task control block */ configASSERT(gMainTask != NULL); /* Start the scheduler to start the tasks executing. */ vTaskStartScheduler(); /* This line should never be reached */ DebugP_assertNoLog(0); return 0; }
where exactly am I going wrong?