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 <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2025-01-29 16:39:22 +01:00
committed by Damien George
parent eccd23feb6
commit 555f1cf488

View File

@@ -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(" ");