工具/软件:Code Composer Studio
我现在正在使用 C++来进行 PRU,并遇到了一个问题,IMEM (指令内存,12KB) 令人不知所措
我应该如何优化我的代码。 这是 我的 PRU 代码的映射(由于.text 已加载到 IMEM 中,因此只有.text 部分), 任何建议都将得到感谢。
我想知道 为什么 Vla_alloc.c.obj 会占用如此多的 IMEM 空间
.text 0 0000001c 00002f68 0000001c 00000770 main.obj (.text:main) 0000078c 00000244 rtspruv3_le.lib:vla_alloc.c.obj (.text:__Vla_alloc) 000009d0 00000200 rruner.obj (.text:_ZN8Rtruner13handle_normalev) 00000bd0 000001dc wdbuf.obj (.text:_ZN5wdbuf12wdbuf_createEPKcj) 00000dac 000001d4. rtspruv3_le.lib:memory.c.obj (.text:realloc) 00000f80 000001bc. rruner.obj (.text:_ZN8Rtruner19ence_Write_TO_RcsEi) 0000113c 00000168 rruner.obj (.text:_ZN8RtrunerC1Ev) 000012a4 00000154 rtspruv3_le.lib:memory.c.obj (.text:malloc) 000013f8 00000128 UART_COMM.obj (.text:_ZN8UARTComm4readEP13BufferFromDSPi) 00001520 00000124 rcs_comm.obj (.text:_ZN7RCSComm4readEP13BufferFromRCS) 00001644 00000120 rruner.obj (.text:_ZN8Rtruner19ence_Write_TO_Dspei) 00001764 0000011c rruner.obj (.text:_ZN8Rtruner20generateDspWritebuffei) 00001880 00000114 rfrter.obj (.text:_ZN8Rtruner18generateIniBufToWdEi) 00001994 000000e8. rrunter.obj (.text:_ZN8Rtruner16handle_server_stoEv) 00001a7c 000000e0 rwdevice_wd.obj (.text:_ZN2Wd5writeEPKhRKj) 00001b5c 000000e0 rruner.obj (.text:_ZN8Rtruner18ence_Write_TO_WdEv) 00001c3c 000000dc rwdevice_wd.obj (.text:_ZN2Wd4readEPhRKj) 00001d18 000000d8 rtspruv3_le.lib:vla_alloc.c.obj (.text:_Z21free_deate_allocationsPv$33) 00001df0 000000d8 rpmsg_lib.lib:PRU_rpmsg.object (.text:PRU_rpmsg_send) 00001ec8 000000c4 :PRU_rpmsg.object (.text:PRU_rpmsg_receive) 00001f8c 000000c0 route_list.obj (.text:_ZN9RouteList5popUpEPhj) 0000204c 000000b8 rtspruv3_le.lib:vla_alloc.c.obj (.text:__Vla_dealloc) 00002104 000000b0 rwdevice_rpmsg.obj (.text:_ZN5Rpmsg4initEPv) 000021b4 000000b0 route_list.obj (.text:_ZN9RouteList8pushBackEPKhj) 00002264 000000a8 rtspruv3_le.lib:memory.c.obj (.text:free) 0000230c 000000a0 rwdevice_wd.obj (.text:_ZN2WdD1Ev) 000023ac 00000094 rwdevice_rpmsg.obj (.text:_ZN5Rpmsg4readEPhRKj) 00002440 00000088 route_list.obj (.text:_ZN9RouteList7getDataEPhj) 000024c8 00000070 rwdevice_UART.obj (.text:_ZN4Uart5writeEPKhRKj) 00002538 00000064 rwdevice_rpmsg.obj (.text:_ZN5Rpmsg5writeEPKhRKj) 0000259c 00000060 rruner.obj (.text:_ZN8RtrunerD1Ev) 000025fc 00000060 rpmsg_lib.lib:PRU_rpmsg.object (.text:PRU_rpmsg_init) 0000265c 00000060 :PRU_virtqueue.object (.text:PRU_virtqueue_get_ave_buf) 000026bc 00000060 :pru_virtqueue.object (.text:pru_virtqueue_init) 0000271c 0000005c rwdevice_UART.obj (.text:_ZN4Uart4initEPv) 00002778 0000005c rpmsg_lib.lib:PRU_rpmsg.object (.text:PRU_rpmsg_channel) 000027d4 0000005c :PRU_virtqueue.object (.text:PRU_virtqueue_add_used_buf) 00002830 00000054 Buffer_from_rc.obj (.text:_ZN13BufferFromRCSC1Ev) 00002884 00000054 crc.obj (.text:_ZN3CRC9crc_ccittEPKhi) 000028d8 00000050 rwdevice_UART.obj (.text:_ZN4Uart4readEPhRKj) 00002928 00000044 PRU_LIST.obj (.text:_ZN7PruList8pushBackEPKhj) 0000296c 00000044 route_list.obj (.text:_ZN9RouteList7freeMemEv) 000029b0 0000003c Buffer_TO_DSP.obj (.text:_ZN11BufferToDSP7setDataEPKhjj) 000029ec 0000003c Buffer_TO_DSP.obj (.text:_ZN11BufferToDSPD1Ev) 00002a28 0000003c Buffer_TO_RC.obj (.text:_ZN11BufferToRCS7setDataEPKhjj) 00002a64 0000003c Buffer_TO_RC.obj (.text:_ZN11BufferToRCSD1Ev) 00002aa0 0000003c Buffer_from_dsp.obj (.text:_ZN13BufferFromDSPD1Ev) 00002adc 0000003c Buffer_from_rc.obj (.text:_ZN13BufferFromRCSD1Ev) 00002b18 00000038 rwdevice_wd.obj (.text:_ZN2Wd4initEPv) 00002b50 00000038 Buffer_TO_RC.obj (.text:_ZN9RWBufBase10updateDataEPKhj) 00002b88 00000034 Buffer_TO_DSP.obj (.text:_ZN11BufferToDSPC1Ev) 00002bbc 00000034 Buffer_TO_RC.obj (.text:_ZN11BufferToRCSC1Ev) 00002bf0 00000034 Buffer_from_dsp.obj (.text:_ZN13BufferFromDSPC1Ev) 00002c24 00000034 rtspruv3_le.lib:memcpy.asm.obj (.text) 00002c58 00000030 pru_counter_operation.obj (.text:_Z19Restart_PRU_counv) 00002c88 00000028 rcs_comm.obj (.text:_ZN7RCSCommC1Ev) 00002cb0 00000028 route_list.obj (.text:_ZN9RouteListC1Ev) 00002cd8 00000028 route_list.obj (.text:_ZN9RouteListD1Ev) 00002d00 00000028 rpmsg_lib.lib:PRU_virtqueue.object (.text:PRU_virtqueue_kick) 00002d28 00000024 Buffer_TO_DSP.obj (.text:_ZN11BufferToDSP11setRoutePosEPKhj) 00002d4c 00000024 Buffer_TO_DSP.obj (.text:_ZN11BufferToDSP14setControlFlagEPKhj) 00002d70 00000024 rtspruv3_le.lib:mpyi.c.obj (.text:_pruabi_mpyi) 00002d94 00000020 wdbuf.obj (.text:_Z6strcpyPcPKc$24) 00002db4 00000020 rwdevice_wd.obj (.text:_ZN2WdC1Ev) 00002dd4 00000020 rtspruv3_le.lib:new.c.obj (.text:_Znwj) 00002df4 0000001c PRU_LIST.obj (.text:_ZN7PruListC1Ev) 00002e10 00000018 rtspruv3_le.lib:typeinfo.c.obj (.text:_ZN10__cxxabiv117__class_type_infoD0Ev) 00002e28 00000018 :typeinfo.c.obj (.text:_ZN10__cxxabiv120__si_class_type_infoD0Ev) 00002e40 00000018 rwdevice_UART.obj (.text:_ZN4UartC1Ev) 00002e58 00000018 UART_COMM.obj (.text:_ZN8UARTCommC1Ev) 00002e70 00000018 prulogger.obj (.text:_ZN9PruloggerC1Ev) 00002e88 00000018 rtspruv3_le.lib:error.c.obj (.text:_abort_execution) 00002ea0 00000018 :memset.c.obj (.text:memset) 00002eb8 00000014 prulogger.obj (.text:_ZN9PruloggerD1Ev) 00002ecc 00000010 pru_counter_operation.obj (.text:_Z21get_PRU_counter_valueev) 00002edc 00000010 Buffer_from_rcs.obj (.text:_ZN13BufferFromRCS14getControlFlagEv) 00002eec 00000010 Buffer_from_rcs.obj (.text:_ZN13BufferFromRCS5getIDEv) 00002efc 00000010 Buffer_from_rcs.obj (.text:_ZN13BufferFromRCS8getParamEv) 00002f0c 00000010 rtspruv3_le.lib:delete.c.obj (.text:_ZdlPv) 00002f1c 0000000c Buffer_from_dsp.obj (.text:_ZN13BufferFromDSP12getTimestampEv) 00002f28 0000000c Buffer_from_dsp.obj (.text:_ZN13BufferFromDSP13getServoBrakeEv) 00002f34 0000000c Buffer_from_dsp.obj (.text:_ZN13BufferFromDSP6getAckEv) 00002f40 0000000c Buffer_from_dsp.obj (.text:_ZN13BufferFromDSP6getPosEv) 00002f4c 00000008 rrunger.obj (.text:_ZN8Rtruner7getdiffEhh) 00002f54 00000008 rfrter.obj (.text:_ZN9RWBufBase10getDataPtrEv) 00002f5c 00000008 Buffer_TO_RC.obj (.text:_ZN9RWBufBase13getDataLengthEv) 00002f64 00000008 route_list.obj (.text:_ZN9RouteList11getRouteLenEv) 00002f6c 00000008 rtspruv3_le.lib:exit.c.obj (.text:abort) 00002f74 00000008 :exit.c.obj (.text:loader_exit) 00002f7c 00000004 :typeinfo.c.obj (.text:_ZN10_cxxabiv117__class_type_infoD1Ev) 00002f80 00000004 :typeinfo.c.obj (.text:_ZN10__cxxabiv120__si_class_type_infoD1Ev)