PSoC Creator: How can I determine the size of my application before flashing?

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

cross mob
djzman078
Level 1
Level 1
5 sign-ins 5 replies posted First reply posted

Hi all,

I'm sorry if this is covered in another post; please point me there if so.  I'm relatively new to PSoC and PSoC Creator (my employer requires that I use PSoC Creator versus MTK or other)

I have, what I think, is a simple question:

I'm adding a couple of features to an existing application.  I've been getting warnings/errors from PSoC Creator during build that I'm exceeding the flash memory available.  I can find a lot of posts and have found the file where I can change the allocation; that is not my question.  Two questions:

1) I can see during download how many "blocks" are being sent.  Am I correct that a "block" is 1K ?  I have seen __cy_memory_0_row_size = 0x200; with makes me doubt my assumption.  Can someone confirm conclusively that the little ticker in the lower left is indicating 1K blocks during download ?

I see numbers like 537 total blocks sent.  My m0p code is larger and my m4 code is currently a few lines.  So, I might think that "most of 537" might be getting close to 512K ?

2) Is there a file that contains the flash image size (as one simple number) after building so I can know how close I'm coming the limit ?  I have looked in the .map files ... hard to discern which number might be giving me the answer.

I'm using CY8C6247BZI-D54, which has 1M flash.  I'm dividing it evenly between the m0p and m4.

0 Likes
7 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

djzman078,

Hopefully the following will be helpful.

The 1M Flash is shared between the m0p and m4 CPU.

If you application is fairly small there should be no issue allocating enough of the 1M Flash.   However, you might to make sure you're not loading extra libraries that you don't need.  Usually the build does a linker optimization to get rid of application code and functions not used.  Libraries however appear to be loaded in its entirety regardless if its being used.

The Output window usually shows the FLASH and RAM being used.

If you're willing to share your project on this forum,  We can look at the "code" hogs and advise better.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Hi Len, thanks much for your reply.

To clarify, the application on the m0p core is quite extensive, and I wouldn't be surprised if I am running close to the memory allocated for m0p.  The application on the m4 core is quite tiny.  Unfortunately, I the application is proprietary, and honestly too big to share.  Also, I can see from the .map file where the hogs are.  What I don't see in the .map file is the total size of the image.  Do you know where I can find that number for each core, respectively?

I do see evidence of linker optimization.  For example, when I remove calls to libraries which are still part of the project, I do see a corresponding reduction in the number of blocks downloaded.

Do you happen to know the answer to the two questions I asked ?

Thanks again.

0 Likes

djzman078,

Can you attach the text output from your Output window?

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Ahhh ... good find ... I assume you were pointing me toward these lines (edited for brevity):

Size of M0 Image
------------------------------------------
C:... xxx.cydsn>echo Size=225440
Size=225440

------------------------------------------
Post-build commands for Cortex-M4 core
------------------------------------------
C:... yyy.cydsn>echo Size=239284
Size=239284

So, is that the actual image size ? ... that would lead me to believe that several of my assumptions were false.

1) the size of the m4 image is not tiny.  I'll look into what's being linked in per your initial recommendation

2) I'm allocating 512K to each core.  I'm running in to the size warning/error way sooner than I would expect if I am only using 225/512 and 239/512.  I inherited the memory allocations and was told "512K flash per core".  I'll look into that also.

I did see the "Memory Configuration", below, in the .map, the nomenclature of which I didn't understand.  Is the memory being further subdivided into 2 application spaces per core ?  (as I said initially, I'm a relative newbie)

3) Since I see "497 blocks", assuming some overhead, I think the ticker during download is indicating 1K blocks.

Thanks for the insights @Len_CONSULTRON ... much appreciated.

Memory Configuration

Name Origin Length Attributes
flash_app0_core0 0x10000000 0x00040000 xr
flash_app0_core1 0x10040000 0x00040000 xr
flash_app1_core0 0x10080000 0x00010000 xr
flash_app1_core1 0x10090000 0x00010000 xr
flash_storage 0x100c0000 0x00001000 rw
flash_boot_meta 0x100d0000 0x00001000 rw
sflash_user_data 0x16000800 0x00000800 xr
sflash_nar 0x16001a00 0x00000200 xr
sflash_public_key 0x16005a00 0x00000c00 xr
sflash_toc_2 0x16007c00 0x00000400 xr
efuse 0x90700000 0x00100000 r
ram_common 0x08000000 0x00000100 xrw
ram_app0_core0 0x08000100 0x00023f00 xrw
ram_app0_core1 0x08024000 0x00023800 xrw
ram_app1_core0 0x08000100 0x00023f00 xrw
ram_app1_core1 0x08024000 0x00023800 xrw
em_eeprom 0x14000000 0x00008000 xr
xip 0x18000000 0x08000000 xr
*default* 0x00000000 0xffffffff

0 Likes

OK, now I don't believe my own answer.  Here's what I think now.  Anyone want to weigh in ?

  1. The first number is, in fact, the size of the m0 image. (225440)
  2. The second number is the combination of the m0p and m4 images combined (239284)
    I ran a test where I commented out some calls to a major library used by the m0p code.  The size of the m0p was reported in the Output window to be 94148 and the m4 size was 107992.  The difference is the same in both cases, 13884, which is the size of the unchanged m4 image (tiny, as originally thought).  Anyone believe this logic ?
  3. If above is correct, then the "blocks" reported in the download ticker are 512 bytes, not 1K?  I did find a reference to, I think it was "rows" being 0x200.

@Len_CONSULTRON , what say you ?

Anyone else have experiences or beliefs in this area ?

Thanks for the forum ... please comment.

 

0 Likes

djzman,

I'm currently working to confirm the type of results you are seeing.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

djzman,

I'm getting somewhat different results when I compile my PSoC6 project under PSoC Creator 4.4.

Here's the last two lines of my rebuild of the project:

code:243418	sram:15368
--------------- Rebuild Succeeded: 12/01/2022 17:41:37 ---------------

It shows a quick summary of code (FLASH) and ram used.

Also, here is my .map file "Memory Configuration" section.

Memory Configuration

Name Origin Length Attributes
ram 0x08024000 0x00023800 xrw
flash 0x10080000 0x00080000 xr
em_eeprom 0x14000000 0x00008000 xr
sflash_user_data 0x16000800 0x00000800 xr
sflash_nar 0x16001a00 0x00000200 xr
sflash_public_key 0x16005a00 0x00000c00 xr
sflash_toc_2 0x16007c00 0x00000200 xr
sflash_rtoc_2 0x16007e00 0x00000200 xr
xip 0x18000000 0x08000000 xr
efuse 0x90700000 0x00100000 r
*default* 0x00000000 0xffffffff

Len
"Engineering is an Art. The Art of Compromise."
0 Likes