[FX3] Memory definition issue for CODE AREA and RTOS HEAP AREA

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

cross mob
HuYa_4249091
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Hi, I've studied the FX3 Programmers Manual for memory related concept. I'm confused with 2 items:

code area.JPG

I don't understand it clearly. We use the external ROM to store FW code(.img file) now.
Q1: In that case, we don't need to use the Code Area at all?

 

RTOS heap area.jpg

I knew the  memory of each thread is created by CyU3PMemAlloc( ) in example code.
Q2: Does it mean that the all the memory created by thread(such as local variable) belong to HEAP memory, not STACK memory?

Any help will be highly appreciated!

0 Likes
1 Solution

Hello,

1. The FX3 ROM Bootloader will download the FW image into code area directly. While doing so, the complete FW image is copied into the CODE AREA and not the fragments. Typically, the size of FW image is around 140KB. The default memory map of FX3 allows upto 180KB of code area. However, if a greater size is required, then the default memory map of FX3 should be modified.

2. Yes, your understanding is correct.

Best Regards,

AliAsgar

View solution in original post

5 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please find my comments to your questions below:

1. The Application firmware will be stored in an external ROM (like EEPROM or flash memory). But, upon power on, the ROM Bootloader will load this firmware stored inside the external EEPROM or flash into the RAM. This loading will take place into code area.

2.  The thread stacks are allocated from the RTOS managed heap area dynamically using the API CyU3PMemAlloc() . All the memory created by a particular thread will belong to its thread stack.

Best Regards,
Jayakrishna

Dear Jayakrishna:

Thanks for your quick reply!

1. The Application firmware will be stored in an external ROM (like EEPROM or flash memory). But, upon power on, the ROM Bootloader will load this firmware stored inside the external EEPROM or flash into the RAM. This loading will take place into code area.

According to the doc, CODE AREA size is 0x2D000(=184,320). However, our external flash size is 4MB which is bigger than CODE AREA size. How does it load ALL external flash content into CODE AREA? or it only loads partial data into CODE AREA?

 


2.  The thread stacks are allocated from the RTOS managed heap area dynamically using the API CyU3PMemAlloc() . All the memory created by a particular thread will belong to its thread stack.


Thread stack's memory belongs to RTOS managed heap area.
Therefore, memory created by a particular thread(such as local variable) belongs to RTOS managed heap area. Is my understanding correct?

Thanks a lot!

0 Likes

Hello,

1. The FX3 ROM Bootloader will download the FW image into code area directly. While doing so, the complete FW image is copied into the CODE AREA and not the fragments. Typically, the size of FW image is around 140KB. The default memory map of FX3 allows upto 180KB of code area. However, if a greater size is required, then the default memory map of FX3 should be modified.

2. Yes, your understanding is correct.

Best Regards,

AliAsgar

Dear AliAsgar:

Thanks for your reply!

1. The FX3 ROM Bootloader will download the FW image into code area directly. While doing so, the complete FW image is copied into the CODE AREA and not the fragments. Typically, the size of FW image is around 140KB. The default memory map of FX3 allows upto 180KB of code area. However, if a greater size is required, then the default memory map of FX3 should be modified.

Q1: It seems like that I just need to select a 200KB's flash, and it's enough. Is it right?

However, according to the CYUSB301X, CYUSB201X: EZ-USB® FX3: SuperSpeed USB Controller doc:

boot.jpg
Q2: The suggested smallest size is 32Mbit = 4MBytes, which is very bigger than 180KBytes.
Why? There are other considerations?

Thanks!

0 Likes

Hello,

The SPI Flash can be used for fail safe firmware loading. For this, multiple firmwares are loaded on to the SPI Flash. Refer this thread for info on SPI fail safe firmware update. Also flash can also be used to store other data depending on the user.

The SPI Flash used with FX3 should be compatible according to the following KBA .

Best Regards,                                                                                                                                                                  AliAsgar