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

PSoC™ Creator & Designer Forum Discussions

JoBr_1593366
Level 5
Level 5
100 sign-ins 50 questions asked 100 replies posted

I temporarily moved the LEDs that were driven by a control register so I could use them for some other testing, and because the control register is now optimized out of the design, all of the functions referencing it now are broken, and I have to go through all my code removing them to get it to build. 

If a control register (or other component) is optimized out of the design, its API functions should be replaced with do-nothing functions and this should be be indicated with warnings, not by breaking the whole project.

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
500 solutions authored 1000 replies posted 750 replies posted

JoBr,

If you can afford the CR resources, you can always leave them in the design even if you don't have LEDs attached anymore.

BTW:  You can use GPIO register calls to drive LEDs.

Len_CONSULTRON_0-1630445458674.png

Pin_LEDs_Write(one_bit_4_each_LED);

 

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

View solution in original post

0 Likes
6 Replies
Len_CONSULTRON
Level 9
Level 9
500 solutions authored 1000 replies posted 750 replies posted

JoBr,

If you can afford the CR resources, you can always leave them in the design even if you don't have LEDs attached anymore.

BTW:  You can use GPIO register calls to drive LEDs.

Len_CONSULTRON_0-1630445458674.png

Pin_LEDs_Write(one_bit_4_each_LED);

 

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

The CR is still in the design, but the build optimizes it out because it doesn't go anywhere anymore.  In that case, the API functions should not fail, since the component is still in the schematic. They should just do nothing, since the component does nothing.

JoBr,

I fully agree with you.  If you put a CR, it should be there if it fits.  This means all the APIs as well.

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

Yeah it's fine to optimize it out, but don't break the build in the process.  When a regular function is unused, it gets optimized out by the compiler, but it doesn't just cease to exist and break the build.

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

JoBr,

Alternatively, you can disable hardware optimization (Project->Build->..)

Yeah but I'm just trying to test something quickly, it shouldn't cause all these other side effects to just disconnect the output of a component.

0 Likes