Is there a macro for the PDL version?

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

cross mob
user_1669321
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

Hi,

I'm implementing a solution to KBA229335 where I replace cy_syspm.c in a pre-build instruction.

However, I'd like to remove this fix when the PDL is updated, thus I would add a precompiler check in cy_syspm.c for the PDL version.

Is there such a macro? Something like:

#define PDL_MAJOR        (3)

#define PDL_MINOR        (1)

#define PDL_MICRO        (2)

0 Likes
1 Solution

Hi user_1669321,

Apologies for the delay. I received an update from the internal team. Unfortunately, there is no such macro in PDL 3.x.x

Regards,

Rakshith

Thanks and Regards,
Rakshith M B

View solution in original post

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

Hi user_1669321​,

Instead of a pre-build instruction, you could try changing the PDL files directly. Whenever the PDL is updated it creates a new folder and thus will not be affected. Please refer to the last two responses in this thread and let me know if this helps - deep sleep being blocked by IPC

Thanks and Regards,

Rakshith

Thanks and Regards,
Rakshith M B
0 Likes

Hi Rakshith,

It's better for me to add the pre-build instruction than to ask every developer to change the file on their disk.

0 Likes

Hi user_1669321,

The PDL used for the build is present in the .cyprj file as shown -

pastedImage_0.png

I am not sure of a PDL version macro. I will check internally and get back to you.

Thanks and Regards,

Rakshith

Thanks and Regards,
Rakshith M B

Thanks Rakshith,

If you tell me that there are no such macros, then I'll be able to do a program that parses the .cypjr and creates a .h with the necessary macros.

I'll wait for your feedback.

0 Likes

Hi user_1669321,

Apologies for the delay. I received an update from the internal team. Unfortunately, there is no such macro in PDL 3.x.x

Regards,

Rakshith

Thanks and Regards,
Rakshith M B
0 Likes

Thank you for the confirmation, Rakshith.

For anyone with the same issue, I wrote these batch files that I run as a pre-build instruction in PSoC Creator. They must be in projet_name.cydsn, and the corrected cy_syspm.c must be at project_name.cydsn/fixed_syspm_folder/cy_syspm.c".

check_pdl_version.bat

@findstr /C:"<pdl_path_for_last_code_gen v=\"C:\Program Files (x86)\Cypress\PDL\3.1.2\" />" projet_name.cyprj

@if %errorlevel%==0 (

    @echo PDL version is 3.1.2! We need to apply the KBA229335 fix.

) else (

    @echo PDL is not 3.1.2 anymore, please remove the KBA229335 fix for 3.1.2 in the pre-build instructions

    @exit /b

)

pre_build_core_0.bat

@echo ------------------------------------------

@echo  Pre-build commands for Cortex-M0+ core

@echo ------------------------------------------

@rem We need to copy this file until PDL update because of KBA229335 (https://community.cypress.com/docs/DOC-18893)

@CALL check_pdl_version

@if %errorlevel%==1 (

    @exit /b %errorlevel%

)

copy ".\fixed_syspm_folder\cy_syspm.c" ".\Generated_Source\PSoC6\pdl\drivers\peripheral\syspm\cy_syspm.c"

Then in Creator, in the Build Settings of the project:

CM0+ -> User Commands -> Pre Build -> Enter pre_build_core_0.bat

Fred