Skip to content

Commit a0aa8c7

Browse files
fkokosinskicarlescufi
authored andcommitted
samples/philosophers: use stack_data_t type
This commit changes the pointer type used in the philosophers demo to `stack_data_t *` when stacks are used for synchronization purposes. The previously used `void *` was causing AMO address-misaligned exception on the HiFive Unleashed platform. Signed-off-by: Filip Kokosinski <[email protected]>
1 parent 814964f commit a0aa8c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

samples/philosophers/src/phil_obj_abstract.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@
8181
uint32_t stack_mem[1];
8282
} fork_obj_t;
8383
#define fork_init(x) do { \
84-
k_stack_init(x, (void *)((x) + 1), 1); \
84+
k_stack_init(x, (stack_data_t *)((x) + 1), 1); \
8585
k_stack_push(x, MAGIC); \
8686
} while ((0))
8787
#endif
8888
#define take(x) do { \
89-
uint32_t data; k_stack_pop(x, (void *)&data, K_FOREVER); \
89+
stack_data_t data; k_stack_pop(x, &data, K_FOREVER); \
9090
__ASSERT(data == MAGIC, "data was %x\n", data); \
9191
} while ((0))
9292
#define drop(x) k_stack_push(x, MAGIC)

0 commit comments

Comments
 (0)