Skip to content

Commit

Permalink
lib: processor: hosted: fix compilation warning in metal_cpu_yield
Browse files Browse the repository at this point in the history
Fix cross inclusion between metal/sys.h and /processor/hosted/cpu.h
replacing metal_cpu_yield() by the zephyr k_yield().

Issue reported by Zephyr twister CI test:

libmetal/lib/include/metal/processor/hosted/cpu.h:19:9:
error: implicit declaration of function ‘metal_wait_usec’
   19 |         metal_wait_usec(10);
      |         ^~~~~~~~~~~~~~~
libmetal/lib/include/metal/system/zephyr/sys.h:46:20:
error: conflicting types for ‘metal_wait_usec’; have ‘void(uint32_t)’
   46 | static inline void metal_wait_usec(uint32_t usec_to_wait)
      |                    ^~~~~~~~~~~~~~~
libmetal/lib/include/metal/processor/hosted/cpu.h:19:9:
note: previous implicit declaration of ‘metal_wait_usec’ with
type ‘void(uint32_t)’ {aka ‘void(unsigned int)’}
   19 |         metal_wait_usec(10);
      |         ^~~~~~~~~~~~~~~

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
  • Loading branch information
arnopo committed Oct 24, 2024
1 parent 7f351a5 commit a75462f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/system/zephyr/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
#ifndef __METAL_ZEPHYR_SYS__H__
#define __METAL_ZEPHYR_SYS__H__

#include <metal/cpu.h>
#include <stdlib.h>
#include <zephyr/kernel.h>

#ifdef __cplusplus
extern "C" {
#endif

#define metal_yield() metal_cpu_yield()
#define metal_yield() k_yield()

#define METAL_INIT_DEFAULTS \
{ \
Expand Down

0 comments on commit a75462f

Please sign in to comment.