Build config with ModusToolbox 2.4

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

cross mob
ms360
Level 1
Level 1
5 sign-ins First solution authored First like received

Hi! I am new to Modus and psoc6. 
I have a few questions about Release vs Debug builds. 
1)

The Makefile CONFIG variable seems to be the way to build the project in Release or Debug mode. 
The IDE build configuration does not seem to affect the actual code build. 

IDE Debug build config -> builds with the CONFIG setting hard coded in Makefile

IDE Release build config -> builds with the CONFIG setting hard coded in Makefile.

In the Makefile, if I set CONFIG=Release, I see -DNDEBUG in my GCC build.
In the Makefile, if I set CONFIG=Debug, I see -DDEBUG in my GCC build. 
This is the result I expect for a Debug vs Release build.

Changing the IDE build config does not give me the DEBUG/NDEBUG I expect.
Can anyone confirm this? What's the best way to accomplish this? 

2) 
Launch configurations are not behaving reliably either with specifying the hexfile path in project settings. 

a) ${config_name:MyProject} -> always renders to Debug, despite IDE Build Configuration 
b) Hard code ALL launches to load the Release hex file (the IDE generated all launches to load the Debug hex file)
    With everything set to Release, Makefile and IDE, and my launch config, it still Error's out when it tries to program
    Error: couldn't open /Users/mike/work/xxxx/yyyy/MyProject/build/CY8CPROTO-062-4343W/Debug/MyProject.hex

What is the proper way to manage which build configuration / hexfile that the launch will use? 
Does IDE Build Configuration actually do anything?

I've also learned that IDE 'exclude files from build' does nothing, and I had to include/e
Thanks!

1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

@ms360@John_K

Apologies for the delay in our response. I believe this thread was missed. Your observations are correct. The idea behind the design of ModusToolbox is to make it IDE agnostic which is the reason it is not tied to the Eclipse IDE build settings. All the build settings should be made in the makefile - 

Rakshith_0-1642543868679.png

Please refer to Section 2.7.1 Use Eclipse IDE in ModusToolbox User Guide.

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
6 Replies
Panometric
Level 5
Level 5
100 sign-ins 100 replies posted 10 solutions authored

I'm seeing the same thing, even when I refresh launches or "make eclipse" per https://www.cypress.com/file/524836/download

Panometric_0-1637801010028.png

It only builds the Debug version. 

0 Likes

I see the same behavior. Can't get the build Config to change based on IDE setting.

@Infineon,

This looks like a bug in the IDE, can you confirm?

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

@ms360@John_K

Apologies for the delay in our response. I believe this thread was missed. Your observations are correct. The idea behind the design of ModusToolbox is to make it IDE agnostic which is the reason it is not tied to the Eclipse IDE build settings. All the build settings should be made in the makefile - 

Rakshith_0-1642543868679.png

Please refer to Section 2.7.1 Use Eclipse IDE in ModusToolbox User Guide.

Thanks and Regards,
Rakshith M B
0 Likes

Rakshith,

I did miss that in the documentation. It was not entirely intuitive since Modus does custom export the project to the Eclipse IDE.

0 Likes

Read that doc several times, and it's still confusing because the terms DEBUG and RELEASE are being used, but only by name, not by definition.  If all the IDE menus are not useful,  they should just be excluded in the MTB Eclipse distro.  That said..

Do I understand correctly that the differences between DEBUG and RELEASE are only optimization, and are hardcoded in the nested makefiles of MTB?

Per 4.5.1.4, If a user want to have other differences between Debug and Release, like other compiler flags, include directories, #defines , etc  could we define two directories CONFIG_DEBUG and CONFIG_RELEASE and then put a different makefile in each one? 

0 Likes

@Panometric,

Thats a good concept. I am actually doing that for the linker scripts. I have different linker scripts in debug and release sub folders, and the makefile linker_script path has  /$(CONFIG)/ in its path so it grabs the right one.

 

Specifying different app makefiles this way might be possible starting up higher in the BSP makefile, assuming CONFIG can be up-leveled there,  since the BSP makefile has a build recipe search:

# Set the default build recipe for this board if not set by the user
include $(dir $(lastword $(MAKEFILE_LIST)))/locate_recipe.mk

 

...but I havent played with this yet.

 

0 Likes