sof icon indicating copy to clipboard operation
sof copied to clipboard

zephyr: macros: Avoid macros redefinition

Open ceolin opened this issue 2 years ago • 9 comments

Some macros defined in SoF are also being defined in Zephyr. Just avoiding redefinition un-defining these macros.

Signed-off-by: Flavio Ceolin [email protected]

ceolin avatar Aug 15 '22 19:08 ceolin

Can one of the admins verify this patch?

reply test this please to run this test once

sofci avatar Aug 15 '22 19:08 sofci

Can one of the admins verify this patch?

gkbldcig avatar Aug 15 '22 20:08 gkbldcig

v2: - Include Zephyr's header where macros are defined. It ensures that Zephyr will not redefine SoF macros.

ceolin avatar Aug 16 '22 05:08 ceolin

v3: - Changed to only define some macros when not building for Zephyr

ceolin avatar Aug 16 '22 18:08 ceolin

v4: - GET_BITS is not going to be exported by Zephyr at moment.https://github.com/zephyrproject-rtos/zephyr/pull/48963#issuecomment-1217148881

ceolin avatar Aug 16 '22 20:08 ceolin

@ceolin I really like the way you add history of updates with v1, v2, ... v4. @lgirdwood we should keep in mind and use that for SOF more often.

dbaluta avatar Aug 17 '22 06:08 dbaluta

The long term direction for SOF on Zephyr platforms is that IP drivers will migrate to Zephyr i.e. the need for bit setting macros will be reduced. We will still need an aligned bit setting macro for xtos users though.

lgirdwood avatar Aug 17 '22 09:08 lgirdwood

@ceolin can you check CI, looks like some build failures.

lgirdwood avatar Aug 17 '22 14:08 lgirdwood

The long term direction for SOF on Zephyr platforms is that IP drivers will migrate to Zephyr i.e. the need for bit setting macros will be reduced. We will still need an aligned bit setting macro for xtos users though.

I have avoided to duplicate these macros on Zephyr in every driver but I hit a road blocker. These macros need a proper namespace, moving them a common place started to conflict with other subsystems / hals.

Regarding CI failing, that is the thing, this change requires the changes on Zephyr as well, it is the chicken and egg problem, Zephyr is also failing because SoF. One thing we can do to avoid break the code base is come back with that initial version that un-define the macros (to avoid re-definition), merge Zephyr changes, then we it again to this latest commit.

ceolin avatar Aug 17 '22 14:08 ceolin

@ceolin fwiw - I'm looking at a more strict partitioning of RTOS headers and logic. See https://github.com/thesofproject/sof/pull/6161 The intent is to make sure we have no contamination in the future between xtos code and zephyr code. Today this is quite tricky to rule out.

lgirdwood avatar Aug 22 '22 10:08 lgirdwood

No activity in a long time, converting as draft.

kv2019i avatar Dec 16 '22 11:12 kv2019i