From 555f1cf4885c65c9ff08e84f068fa175d3d8127d Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Wed, 29 Jan 2025 16:39:22 +0100 Subject: [PATCH] py/asmxtensa: Make the generated code dumper work on mpy-cross. This commit fixes compilation errors occurring when enabling the Xtensa code dumper inside mpy-cross. The original code was meant to dump the code from an Xtensa device itself, but for debugging the inline assembler this functionality was also needed off-line. The changes involve solving a signed/unsigned mismatch that was not much of a problem for the 8266's gcc version but made modern compilers complain, and using the printf formatter for pointers when it comes to printing code addresses. Signed-off-by: Alessandro Gatti --- py/asmxtensa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/asmxtensa.c b/py/asmxtensa.c index 41bfcb54e..11b61ad94 100644 --- a/py/asmxtensa.c +++ b/py/asmxtensa.c @@ -49,9 +49,9 @@ void asm_xtensa_end_pass(asm_xtensa_t *as) { if (as->base.pass == MP_ASM_PASS_EMIT) { uint8_t *d = as->base.code_base; printf("XTENSA ASM:"); - for (int i = 0; i < ((as->base.code_size + 15) & ~15); ++i) { + for (size_t i = 0; i < ((as->base.code_size + 15) & ~15); ++i) { if (i % 16 == 0) { - printf("\n%08x:", (uint32_t)&d[i]); + printf("\n%p:", &d[i]); } if (i % 2 == 0) { printf(" ");