Out of CX3 memory

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ScGr_289066
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

Hi All,

I have been working on this firmware (https://community.cypress.com/thread/16971?start=0&tstart=0) and have finally run out of memory?  When I compile my latest code, the linker spits out:

c:/program files (x86)/cypress/ez-usb fx3 sdk/1.3/arm gcc/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: OV5647_dual_camera_NOUVC_e.elf section `i._tx_mutex_prioritize' will not fit in region `SYS_MEM'

c:/program files (x86)/cypress/ez-usb fx3 sdk/1.3/arm gcc/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: section .data loaded at [40030000,4003188f] overlaps section i._tx_mutex_prioritize loaded at [4002ff00,400300ff]

c:/program files (x86)/cypress/ez-usb fx3 sdk/1.3/arm gcc/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: section i._tx_queue_cleanup loaded at [40030100,400301b7] overlaps section .data loaded at [40030000,4003188f]

c:/program files (x86)/cypress/ez-usb fx3 sdk/1.3/arm gcc/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: region `SYS_MEM' overflowed by 440 bytes

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\/arm-none-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r':

writer.c:(.text+0x20): undefined reference to `_write'

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\/arm-none-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r':

closer.c:(.text+0x18): undefined reference to `_close'

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\/arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':

lseekr.c:(.text+0x20): undefined reference to `_lseek'

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\/arm-none-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r':

readr.c:(.text+0x20): undefined reference to `_read'

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\/arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':

sbrkr.c:(.text+0x18): undefined reference to `_sbrk'

collect2.exe: error: ld returned 1 exit status

cs-make: *** [OV5647_dual_camera_NOUVC_e.elf] Error 1

13:08:43 Build Finished (took 13s.977ms)

The linker map files are pretty confusing to look at so I have written a little program to summarize lengths of the various modules.  When I look at the current version of my code, and a former version that does compile without error, I see the current version is *shorter* than the old version that compiles, which is perplexing.  This brings up numerous questions:

1) Can someone point me to a document that discusses the various memory sections used by the CX3 libraries?

2) The CX3 (CYUSB3064) part data sheet says the parts have 512 or 256 KB of SRAM but there is no mention as to which family member has how much memory.  Are we to guess that the 4-lane version has 512K and the 2-lane as 256K?

3) Neither program is anywhere near close to this limit, is SYS_MEM some special memory section that must be considered separately, or am I not understanding how data is loaded for CX3 execution?

4) I have seen the compiler spit out similar errors when I had a grave macro syntax problem.  I had imbalanced parenthesis in a macro and compensated for it by adding an extra parenthesis in the macro expansion.  The compiler didn't mention and memory overlaps, but did spit out many missing symbol errors (_sbrk, _write, _close, ...).

Thanks as always,

Scott

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Scott,

You need to modify the .ld file to increase the SYS_MEM (180 KB).

This can be done in the .ld file and cyfxtx.c file.

Note that once you change the .ld, ensure that modifed .ld file is used in Linker Settings.

Just by changing the CY_U3P_SYS_MEM_TOP to 0x40080000 will not increase the code area.

This will increase only DMA area.

I did the required modification and provided the files with this response.

The modfied settings are as follows:

Memory Configuration

Name             Origin             Length             Attributes

I-TCM            0x00000100         0x00003f00

SYS_MEM          0x40003000         0x00035000

DATA             0x40038000         0x00008000

Application memory map for FX3 firmware is as follows:

   Descriptor area    Base: 0x40000000 Size: 12  KB

   Code area          Base: 0x40003000 Size: 212 KB

   Data area          Base: 0x40038000 Size: 32  KB

   Driver heap        Base: 0x40040000 Size: 32  KB

  Buffer area        Base: 0x40048000 Size: 224 KB // DMA is same.

  2-stage boot area  Base: 0x40080000 Size: 0  KB

Please use the attached .ld file and cyfxtx.c file in your project and build the firmware.

The path for .ld file to be replaced can be checked in Linker settings as shown in below diagram.

Please replace cyfxtx.c file in the project.

pastedImage_2.png

Regards,

Sridhar

View solution in original post

0 Likes
6 Replies