I'm trying to get an image array from a bin file located in the source folder and pass it to a function. It can be located in the SD card that insert to the board.
Are there any prebuild libraries to achieve file open/read tasks. (To grab the bin file)
I'm using i.mx rt1060 board for development.
No directly open/read tasks.
But you can write your own code to read the bin located address if it is in the internal flash, you just need to define the .bin file to the specific flash address, or you save your bin file to the array at first by other tool, then in the code, you can read it together.
But if your bin file already put in the sd card, you can use the fatfs file to open it.
Wish it helps you!
Best Regards,
Kerry
Thank you for the response.
I'm currently using MCUExpresso IDE for development.
As you mention "you just need to define the .bin file to the specific flash address" is there an easy way of doing such a thing in that IDE or how can I achieve it?
A good example for your reference, you can refer to the RT600 SDK:
\SDK_2_11_1_EVK-MIMXRT685\boards\evkmimxrt685\dsp_examples\hello_world_usart\cm33
This code, you will find the dsp.bin is defined to the specific area in the flash.
This also has the mcuxpresso project, you can check it.
Another simple way, you can check the RT1050 SDK project dcd.c, you can find it also use the array put the dcd data directly, you can resave your .bin to the array directly. Then define it like the dcd array.
Best Regard,
kerry
I refered the hello_world_usart project in evkmimxrt685.
/* Address of RAM, where the image for dsp should be copied */
#define DSP_BOOT_ADDRESS (uint32_t *)0x24000000
#define DSP_SRAM_ADDRESS (uint32_t *)0x00200000
void DSP_CopyImage(dsp_copy_image_t *dspCopyImage)
{
assert(dspCopyImage != NULL);
assert(dspCopyImage->srcAddr != NULL);
assert(dspCopyImage->destAddr != NULL);
uint32_t *srcAddr = dspCopyImage->srcAddr;
uint32_t *destAddr = dspCopyImage->destAddr;
uint32_t size = dspCopyImage->size;
assert((size & 3U) == 0U);
while (size > 0U)
{
*destAddr++ = *srcAddr++;
size -= 4U;
}
}
#ifndef DSP_IMAGE_COPY_TO_RAM
#define DSP_IMAGE_COPY_TO_RAM 1
#endif
#if DSP_IMAGE_COPY_TO_RAM
#if defined(__GNUC__) || defined(__ARMCC_VERSION)
.section .dspcode , "ax" @progbits @preinit_array
.global dsp_text_image_start
.type dsp_text_image_start, %object
.align 2
I could not find a reference code that place a specific .bin file in a flash address.
Am I missing something? Can you clarify more.
Hi @ViduraErandika ,
You nearly list the related code now.
The incbin.s code is used to input the .bin code, and put it to the determined address which is defined in DSP_BOOT_ADDRESS, DSP_SRAM_ADDRESS.
This code input two .bin file.
If you think it is completed, a simple way, just resave your .bin to the array directly, then add it to the code, and in the linker file, arrange one area, then define your array to that flash area is OK.
Best Regards,
kerry