how to reduce code size to save flash size

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

cross mob
Anonymous
Not applicable

Hi

i am working with cyble 22001 ble which has 128 kb flash and 16kb SRAM.

but  due to my code flash size becomes morethan 128kb  and sram becomes morethan 16kb .

If i choose code optimization option then code reduces to less than 128kb but code is not working.

Please help me to resolve the issue

Thanks in advance

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When after code optimization a program doesn't run anymore check for the following:

Every global variable that is changed within an interrupt handler must be declared as volatile.

Btw: Code optimization can be set on a .c file basis.

Bob

View solution in original post

3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When after code optimization a program doesn't run anymore check for the following:

Every global variable that is changed within an interrupt handler must be declared as volatile.

Btw: Code optimization can be set on a .c file basis.

Bob

RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

If you are using GCC, you can switch to MDK ARMCC. The later does a better job optimizing the code.

RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

An application notes about this topic is FYI.

AN89610 - PSoC® 4 and PSoC 5LP Arm® Cortex® Code Optimization

Thanks,

Ryan