Modify code size in fx3.ld file

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,
I am working on FX3 firmware, my firmware size about 200KB is bigger than the default 180KB in fx3.ld, I changed the fx3.ld file as attached:

SYS_MEM : ORIGIN = 0x40003000 LENGTH = 0x3D000
DATA : ORIGIN = 0x40040000 LENGTH = 0x8000

Also I changed the RTOS heap area in cyfxtx.c

#define CY_U3P_MEM_HEAP_BASE ((uint8_t *)0x40040000/*0x40038000*/)
#define CY_U3P_MEM_HEAP_SIZE (0x8000)

Compiler PASS, but PC host can't build the connection with FX3. If I reduced the file size and used the defualt fx3.ld, everything works normally.

What is my problem and how to fix it? Thank you!

 

0 Likes
5 Replies
Anonymous
Not applicable

Hi Yi,

   

 

   

I think you should change the MEM_HEAP_BASE in the cyfxtx.c file not as you wrote

   

 

   

#define CY_U3P_MEM_HEAP_BASE ((uint8_t *)0x40040000/*0x40038000*/)
#define CY_U3P_MEM_HEAP_SIZE (0x8000)

   

 

   

because you are using 0x10000 more so you should use 0x40048000 instead of 0x40040000 like

   

 

   

#define CY_U3P_MEM_HEAP_BASE ((uint8_t *)0x40048000/*0x40038000*/)
#define CY_U3P_MEM_HEAP_SIZE (0x8000)

   

 

   

regards

   

Lumpi

0 Likes
Anonymous
Not applicable

 Hi all,

   

Can you please kindly advise how to check the firmware size or the memory allocation?

   

Is there a report file?

   

Thanks!!

0 Likes
Anonymous
Not applicable

Gary,

   

The physical size of the .img file itself give you the size of the image.

   

You can just look at the properties of the .img file.

   

Thanks,

   

sai krishna.

0 Likes
Anonymous
Not applicable

Hi sai krishna,

   

Thanks a lot! 

0 Likes
Anonymous
Not applicable

 Why did you have to change the heap size, could you just change the code size in the fx3.ld file and the script would recalculated the heap for you.

0 Likes