wrong macro check in some files

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

wrong macro check in some files

Jump to solution
433 Views
mastupristi
Senior Contributor I

Hi

I refer to SDK 25.06.00.

My projects can use FreeRTOS or be bare metal.

So I can have the USE_RTOS symbol defined as 0 or 1.

And this is generally fine because when the check is done, it is usually:

#if (defined(USE_RTOS) && (USE_RTOS > 0U))

see https://github.com/nxp-mcuxpresso/mcux-component/blob/main/lists/fsl_component_generic_list.c#L17

or https://github.com/nxp-mcuxpresso/mcux-component/blob/main/mem_manager/fsl_component_mem_manager.c#L...

So, as I already mentioned in my bare metal projects, I feel free to set USE_RTOS to 0.

In the fsl_os_abstraction.h file itself, there is this define under certain conditions:

https://github.com/nxp-mcuxpresso/mcux-component/blob/main/osa/fsl_os_abstraction.h#L194

However, there are some files released by NXP that do not follow this paradigm, for example ./middleware/mcuboot_opensource/boot/nxp_mcux_sdk/include/os/os_malloc.h

where the check is simply:

#if defined(USE_RTOS)

https://github.com/nxp-mcuxpresso/mcuboot/blob/mcux_main/boot/nxp_mcux_sdk/include/os/os_malloc.h#L2...

Obviously, this check is not valid if USE_RTOS is defined as 0 in order to disable the functionality.

This is not the only example.
I would ask you to review your entire code base and fix this problem.

best regards

Max

0 Kudos
Reply
1 Solution
418 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @mastupristi 

 

 Yes, you are right.  This is a known issue and I will forward it to  the software team .

Thanks a lot for your feedback.

 

Regards

Daniel

View solution in original post

0 Kudos
Reply
1 Reply
419 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @mastupristi 

 

 Yes, you are right.  This is a known issue and I will forward it to  the software team .

Thanks a lot for your feedback.

 

Regards

Daniel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2166550%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ewrong%20macro%20check%20in%20some%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2166550%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3EI%26nbsp%3Brefer%20to%20SDK%2025.06.00.%3C%2FP%3E%3CP%3EMy%20projects%20can%20use%20FreeRTOS%20or%20be%20bare%20metal.%3C%2FP%3E%3CP%3ESo%20I%20can%20have%20the%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EUSE_RTOS%3C%2FFONT%3E%20symbol%20defined%20as%200%20or%201.%3C%2FP%3E%3CP%3EAnd%20this%20is%20generally%20fine%20because%20when%20the%20check%20is%20done%2C%20it%20is%20usually%3A%3C%2FP%3E%3CPRE%3E%23if%20(defined(USE_RTOS)%20%26amp%3B%26amp%3B%20(USE_RTOS%20%26gt%3B%200U))%3C%2FPRE%3E%3CP%3Esee%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-mcuxpresso%2Fmcux-component%2Fblob%2Fmain%2Flists%2Ffsl_component_generic_list.c%23L17%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-mcuxpresso%2Fmcux-component%2Fblob%2Fmain%2Flists%2Ffsl_component_generic_list.c%23L17%3C%2FA%3E%3C%2FP%3E%3CP%3Eor%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-mcuxpresso%2Fmcux-component%2Fblob%2Fmain%2Fmem_manager%2Ffsl_component_mem_manager.c%23L20%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-mcuxpresso%2Fmcux-component%2Fblob%2Fmain%2Fmem_manager%2Ffsl_component_mem_manager.c%23L20%3C%2FA%3E%3C%2FP%3E%3CP%3ESo%2C%20as%20I%20already%20mentioned%20in%20my%20bare%20metal%20projects%2C%20I%20feel%20free%20to%20set%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EUSE_RTOS%3C%2FFONT%3E%20to%200.%3C%2FP%3E%3CP%3EIn%20the%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Efsl_os_abstraction.h%3C%2FFONT%3E%20file%20itself%2C%20there%20is%20this%20define%20under%20certain%20conditions%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-mcuxpresso%2Fmcux-component%2Fblob%2Fmain%2Fosa%2Ffsl_os_abstraction.h%23L194%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-mcuxpresso%2Fmcux-component%2Fblob%2Fmain%2Fosa%2Ffsl_os_abstraction.h%23L194%3C%2FA%3E%3C%2FP%3E%3CP%3EHowever%2C%20there%20are%20some%20files%20released%20by%20NXP%20that%20do%20not%20follow%20this%20paradigm%2C%20for%20example%20.%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3E%2Fmiddleware%2Fmcuboot_opensource%2Fboot%2Fnxp_mcux_sdk%2Finclude%2Fos%2Fos_malloc.h%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Ewhere%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Ethe%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Echeck%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Eis%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Esimply%3C%2FSPAN%3E%3C%2FSPAN%3E%3A%3C%2FP%3E%3CPRE%3E%23if%20defined(USE_RTOS)%3C%2FPRE%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-mcuxpresso%2Fmcuboot%2Fblob%2Fmcux_main%2Fboot%2Fnxp_mcux_sdk%2Finclude%2Fos%2Fos_malloc.h%23L23%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-mcuxpresso%2Fmcuboot%2Fblob%2Fmcux_main%2Fboot%2Fnxp_mcux_sdk%2Finclude%2Fos%2Fos_malloc.h%23L23%3C%2FA%3E%3C%2FP%3E%3CP%3EObviously%2C%20this%20check%20is%20not%20valid%20if%20USE_RTOS%20is%20defined%20as%200%20in%20order%20to%20disable%20the%20functionality.%3C%2FP%3E%3CP%3EThis%20is%20not%20the%20only%20example.%3CBR%20%2F%3EI%20would%20ask%20you%20to%20review%20your%20entire%20code%20base%20and%20fix%20this%20problem.%3C%2FP%3E%3CP%3Ebest%20regards%3C%2FP%3E%3CP%3EMax%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2166663%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20wrong%20macro%20check%20in%20some%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2166663%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F124967%22%20target%3D%22_blank%22%3E%40mastupristi%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%26nbsp%3BYes%2C%20you%20are%20right.%26nbsp%3B%20This%20is%20a%20known%20issue%20and%20I%20will%20forward%20it%20to%26nbsp%3B%20the%20software%20team%20.%3C%2FP%3E%0A%3CP%3EThanks%20a%20lot%20for%20your%20feedback.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%3C%2FLINGO-BODY%3E