Limit App Size via PSOC creator

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

cross mob
D_Sd_3235936
Level 4
Level 4
25 sign-ins 50 questions asked 25 replies posted

I want to set an upper limit size for my application.

In case application takes more space than my set value, PSOC will not allow compilation of the code.

Where can I set this limit?

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

You can edit the memory regions in the linker script. For the GNU linker, it is the MEMORY command in the .ld file. Once you have defined a region of memory named mem, you can direct specific output sections there by using a command ending in `>mem' within the SECTIONS command. If the memory overflows the linker will throw an error. There is no setting to stop allowing compilation of code though.

Regards,

Dheeraj

View solution in original post

0 Likes
4 Replies
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

You have an interesting question.  I could not find a menu/command that could be used with Creator to limit app memory size.  But, maybe there is a way to work around this.

Let's say FLASH memory is 32k and you want to limit app size to 2k.  You could #include a dummy data file that contains 30k bytes of data.  When the project is built, maybe Creator will complain when app size + dummy data exceeds 32k.  This would be the indication the app has exceeded its 2k size limit.

I'm guessing, the dummy data file would be placed in the same folder as main.c.  I've never tried this.

Not a great answer to your question, but maybe this would result in the same outcome.

Bill

0 Likes

Hi Bill,

I work with Dima.

Thank you for your kind response.

It is an interesting solution but it does not answer our requirement.

We need to have an empty section in the flash. So by filling it with a dummy data file, it does not meet our needs.

Thanks,

David

0 Likes

BTW, the dummy file could be all FF's, which leaves the FLASH available for programming from an app.

Instead of a dummy file, an array of constants ($ff) would also work.

Creator outputs a line of text to indicate memory usage for both code and data spaces after it builds a load.  Maybe you can build a script to detect/interpret this text.  This text is stored in a log file.

I've still not come up with a good answer for using Creator to do the work of limiting project memory space.  If you want to dig deeper, you can control the compile/build process from command scripts.

See Building a PSoC® Creator™ Project from the Command Prompt – KBA88169

There's also a thread about this:

External build command, PSoC Creator 3

[edit]

I forgot to mention, the dummy data file is only used to get a warning from Creator when project exceeds available FLASH size.  For the final Build, delete the #include and FLASH space is restored for whatever future programming is needed.

regards,

Bill

0 Likes
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

You can edit the memory regions in the linker script. For the GNU linker, it is the MEMORY command in the .ld file. Once you have defined a region of memory named mem, you can direct specific output sections there by using a command ending in `>mem' within the SECTIONS command. If the memory overflows the linker will throw an error. There is no setting to stop allowing compilation of code though.

Regards,

Dheeraj

0 Likes