When I added a USB LDD device to the pe_demo_twrk40x256 MQX sample project, it generated an error indicating that "_mem_alloc_system_align" is not defined. I have not found any reference to this function in the MQX documentation. This code is generated by Processor expert, and I do not know how to resolve the erorr. I am using CW10.1 and MQX 3.7. Any suggestions are greatly appreicated.
已解决! 转到解答。
Have your recompiled all : BSP, PSP and the application ? I recommend to clean all these project, recompile with the given option.
best regards
Petr Hradsky
Processor Expert Support Team
The integration of Processor Expert is done at the BSP level. You should add USB LDD to \src\mqx\build\cw10\bsp_twrk40x256_pe BSP. Then regenerate code, recompile BSP and then you can call USB LDD components from your application.
I got exacly the same error;
Added USB_LLD PE Component in BSB, compiled without problems.
But in the MQX Application I got the Error:
(D:\Freescale\Freescale MQX 3.7\mqx\build\cw10\bsp_twrk60n512_pe\Generated_Code\USB0.c|707|0|0|0|0)
=Referenced from "USB0_Init" in bsp_twrk60n512_d.a
>Undefined : "_mem_alloc_system_align"
The USB device lib is linked to the application.
I was able to get a solution to this problem via a service request. This is the response from Freescale regarding the problem.
We made a quick analysis and there seem to be two problems: - The funtion _mem_alloc_system_align seems not to be present in latest MQX. So as the customer correctly observed, it's necessary to use _mem_alloc_align instead. - The _mem_alloc_align is available only if the BSP and PSP is recompiled with the option MQX_USE_LWMEM_ALLOCATOR set to 0. It should help adding #define MQX_USE_LWMEM_ALLOCATOR 0 to for example small_ram_config.h file, before this symbol is used." For a current workaround you can use "_mem_alloc_align", enable the allocator macro and recompile the BSP/PSP. Processor Expert team is getting more details on the best solution for these problems so that they get fixed for further releases of PExpert.
Attached is the updated MQX RTOS adapter in the zip file. Copy the zipped _MQX_RTOSAdaptor.prg file into MCU 10.1 installation directory {CW MCU v10.1}\MCU\ProcessorExpert\Drivers\sw\RTOSAdaptor\_MQX_RTOSAdaptor.prg. I recommend to backup the existing _MQX_RTOSAdaptor.prg file first.
Note: Workaround mentioned above (MQX_USE_LWMEM_ALLOCATOR) have to be used for MQX 3.7 henceforth.
Best regards,
Marek V.
When setting "#define MQX_USE_LWMEM_ALLOCATOR 0" I get a bunch of new errors:
D:/Freescale/CW MCU v10.1/MCU/ARM_Tools/Command_Line_Tools/mwldarm|Linker|Error
(D:\Freescale\Freescale MQX 3.7\mqx\source\io\adc\adc.c|65|0|0|0|0)
=Referenced from "_io_adc_install" in bsp_twrk60n512_d.a
>Undefined : "_mem_alloc"
D:/Freescale/CW MCU v10.1/MCU/ARM_Tools/Command_Line_Tools/mwldarm|Linker|Error
(D:\Freescale\Freescale MQX 3.7\mqx\source\bsp\twrk60n512\init_bsp.c|83|0|0|0|0)
=Referenced from "_bsp_enable_card" in bsp_twrk60n512_d.a
>Undefined : "_mem_alloc_at"
D:/Freescale/CW MCU v10.1/MCU/ARM_Tools/Command_Line_Tools/mwldarm|Linker|Error
(D:\Freescale\Freescale MQX 3.7\mqx\build\cw10\bsp_twrk60n512_pe\Generated_Code\ADC_1.c|142|0|0|0|0)
=Referenced from "ADC_1_Init" in bsp_twrk60n512_d.a
>Undefined : "_mem_alloc_system"
D:/Freescale/CW MCU v10.1/MCU/ARM_Tools/Command_Line_Tools/mwldarm|Linker|Error
(D:\Freescale\Freescale MQX 3.7\mqx\build\cw10\bsp_twrk60n512_pe\Generated_Code\CAN.c|144|0|0|0|0)
=Referenced from "CAN_Init" in bsp_twrk60n512_d.a
>Undefined : "_mem_alloc_system"
D:/Freescale/CW MCU v10.1/MCU/ARM_Tools/Command_Line_Tools/mwldarm|Linker|Error
(D:\Freescale\Freescale MQX 3.7\mqx\build\cw10\bsp_twrk60n512_pe\Generated_Code\GPIO_ACC1_INT.c|94|0|0|0|0)
=Referenced from "GPIO_ACC1_INT_Init" in bsp_twrk60n512_d.a
>Undefined : "_mem_alloc_system"
Have your recompiled all : BSP, PSP and the application ? I recommend to clean all these project, recompile with the given option.
best regards
Petr Hradsky
Processor Expert Support Team