zephyrproject-rtos / openocd

OpenOCD with Zephyr patches for building Zephyr SDK
Other
28 stars 45 forks source link

upstream sync to 9d8c91ef4 #43

Closed MaroMetelski closed 3 years ago

MaroMetelski commented 3 years ago

Upgrade to 9d8c91ef4. I'm particularly interested in RTT support f5a1b4a.

Upstream compatiblity breaks on next commit http://openocd.zylin.com/#/c/5937/ This breaks on RV32M1 support pulled from openisa.

galak commented 3 years ago

How does - RV32M1 support pulled from openisa. break?

MaroMetelski commented 3 years ago

src/target/rv32m1/rv32m1.c: In function ‘rv32m1_save_context’: src/target/rv32m1/rv32m1.c:156:47: error: passing argument 4 of ‘du_core->rv32m1_jtag_read_cpu’ from incompatible pointer type [-Werror=incompatible-pointer-types] target->reg_cache->reg_list[i].value);


src/target/rv32m1/rv32m1.c:156:47: note: expected ‘uint32_t *’ {aka ‘unsigned int *’} but argument is of type ‘uint8_t *’ {aka ‘unsigned char *’}
src/target/rv32m1/rv32m1.c:168:47: error: passing argument 4 of ‘du_core->rv32m1_jtag_read_cpu’ from incompatible pointer type [-Werror=incompatible-pointer-types]
target->reg_cache->reg_list[i].value);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
src/target/rv32m1/rv32m1.c:168:47: note: expected ‘uint32_t *’ {aka ‘unsigned int *’} but argument is of type ‘uint8_t *’ {aka ‘unsigned char *’}
src/target/rv32m1/rv32m1.c:183:44: error: passing argument 4 of ‘du_core->rv32m1_jtag_read_cpu’ from incompatible pointer type [-Werror=incompatible-pointer-types]
target->reg_cache->reg_list[reg_idx].value);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
src/target/rv32m1/rv32m1.c:183:44: note: expected ‘uint32_t *’ {aka ‘unsigned int *’} but argument is of type ‘uint8_t *’ {aka ‘unsigned char *’}
src/target/rv32m1/rv32m1.c: In function ‘rv32m1_restore_context’:
src/target/rv32m1/rv32m1.c:235:51: error: passing argument 4 of ‘du_core->rv32m1_jtag_write_cpu’ from incompatible pointer type [-Werror=incompatible-pointer-types]
target->reg_cache->reg_list[i].value);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
src/target/rv32m1/rv32m1.c:235:51: note: expected ‘const uint32_t *’ {aka ‘const unsigned int *’} but argument is of type ‘uint8_t *’ {aka ‘unsigned char *’}
src/target/rv32m1/rv32m1.c:250:51: error: passing argument 4 of ‘du_core->rv32m1_jtag_write_cpu’ from incompatible pointer type [-Werror=incompatible-pointer-types]
target->reg_cache->reg_list[i].value);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
src/target/rv32m1/rv32m1.c:250:51: note: expected ‘const uint32_t *’ {aka ‘const unsigned int *’} but argument is of type ‘uint8_t *’ {aka ‘unsigned char *’}
src/target/rv32m1/rv32m1.c: In function ‘rv32m1_get_core_reg’:
src/target/rv32m1/rv32m1.c:286:37: error: passing argument 4 of ‘du_core->rv32m1_jtag_read_cpu’ from incompatible pointer type [-Werror=incompatible-pointer-types]
1, reg->value);
~~~^~~~~~~
src/target/rv32m1/rv32m1.c:286:37: note: expected ‘uint32_t *’ {aka ‘unsigned int *’} but argument is of type ‘uint8_t *’ {aka ‘unsigned char *’}
src/target/rv32m1/rv32m1.c: In function ‘rv32m1_build_reg_cache’:
src/target/rv32m1/rv32m1.c:387:28: error: assignment to ‘uint8_t *’ {aka ‘unsigned char *’} from incompatible pointer type ‘uint32_t *’ {aka ‘unsigned int *’} [-Werror=incompatible-pointer-types]
cache->reg_list[i].value = &(rv32m1->reg_cache_mem[i]);
^

Those functions rv32m1_jtag_read/write_cpu relied on reg.value being of type void *. Since it was changed to uint8_t * it is broken. (in http://openocd.zylin.com/#/c/5937/) I crafted something simple based on RISCV adapations to the change, which could possibly adapt the RV32M1 in similar way. I have no idea though whether this could work or makes sense. -> 1275453517568ad114b16482f16df86301898f88

Anyway I see this may be a trouble when wanting to have both a new stable upstream OpenOCD releases (possibly with upstream zephyr support) and the RV32M1 support.

galak commented 3 years ago

Closing this as we'll start an new upstream branch to pull in latest openocd code.