Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for STM32G4 targets #11

Closed

Conversation

rosterloh
Copy link

Flash definitions for STM32G4 devices and Nucleo boards

Signed-off-by: Richard Osterloh richard.osterloh@gmail.com

Flash definitions for STM32G4 devices and Nucleo boards

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious if this has been sent to upstream openocd?

@rosterloh
Copy link
Author

It hasn't no

@galak
Copy link
Contributor

galak commented Sep 3, 2019

It hasn't no

Would appreciate if you can do that first.

@rosterloh
Copy link
Author

There is this one currently open http://openocd.zylin.com/#/c/4807

I did this work to test my PRs the have been submitted to zephyr main repo. To be quite honest I don't have the time to go through all of these reviews. I thought I'd be helpful and give back.

@galak
Copy link
Contributor

galak commented Oct 3, 2019

There is this one currently open http://openocd.zylin.com/#/c/4807

I did this work to test my PRs the have been submitted to zephyr main repo. To be quite honest I don't have the time to go through all of these reviews. I thought I'd be helpful and give back.

Do your changes differ from that upstream change?

I'm find with pulling something in for STM32G4 just want to understand what's the source, and what the long term maintenance might be for it.

@rosterloh
Copy link
Author

@galak The upstream PR adds the G0 and G4 devices in with the L4 series which I don't think is a great idea. I have isolated the G4 but I'm happy to wait for the upstream merge and test it.

@galak
Copy link
Contributor

galak commented Nov 7, 2020

closing as stm32g4 is merged upstream.

@galak galak closed this Nov 7, 2020
abrodkin added a commit to abrodkin/openocd that referenced this pull request Nov 10, 2021
In zephyrproject-rtos/zephyr#35284 it was
found that use of "verify_image" command for ARC boards lead to
OpenOCD segfault:
--------------------------->8--------------------------
 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000000000 in ?? ()
 (gdb) bt
 #0  0x0000000000000000 in ?? ()
 zephyrproject-rtos#1  0x0000000000455e27 in target_checksum_memory (target=target@entry=0xa52450, address=2415919104, size=19952, crc=crc@entry=0x7fffffffcf64) at src/target/target.c:2522
 zephyrproject-rtos#2  0x0000000000456066 in handle_verify_image_command_internal (cmd=0x7fffffffd040, verify=IMAGE_VERIFY) at src/target/target.c:3846
 zephyrproject-rtos#3  0x000000000047e4ca in run_command (num_words=2, words=0xa80800, c=0x9f3ea0, context=0x9a7010) at src/helper/command.c:582
 zephyrproject-rtos#4  exec_command (argv=0x7fffffffd140, argc=<optimized out>, c=0x9f3ea0, cmd_ctx=0x9a7010, interp=0x9a7070) at src/helper/command.c:950
 zephyrproject-rtos#5  jim_command_dispatch (interp=0x9a7070, argc=<optimized out>, argv=0x7fffffffd140) at src/helper/command.c:1001
 zephyrproject-rtos#6  0x00000000005b839a in JimInvokeCommand (interp=interp@entry=0x9a7070, objc=objc@entry=2, objv=objv@entry=0x7fffffffd140) at jim.c:10514
 zephyrproject-rtos#7  0x00000000005b8fbc in Jim_EvalObj (interp=interp@entry=0x9a7070, scriptObjPtr=scriptObjPtr@entry=0x9e96d0) at jim.c:11006
 zephyrproject-rtos#8  0x00000000005bb12b in Jim_EvalSource (interp=interp@entry=0x9a7070, filename=filename@entry=0x0, lineno=lineno@entry=0,
     script=script@entry=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at jim.c:11298
 zephyrproject-rtos#9  0x000000000047df5f in command_run_line (context=context@entry=0x9a7010, line=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at src/helper/command.c:626
 zephyrproject-rtos#10 0x000000000047f6b8 in parse_config_file (cmd_ctx=cmd_ctx@entry=0x9a7010) at src/helper/configuration.c:136
 zephyrproject-rtos#11 0x00000000004053ae in openocd_thread (cmd_ctx=0x9a7010, argv=0x7fffffffd378, argc=18) at src/openocd.c:296
 zephyrproject-rtos#12 openocd_main (argc=18, argv=0x7fffffffd378) at src/openocd.c:356
 zephyrproject-rtos#13 0x00007ffff710d505 in __libc_start_main () from /lib64/libc.so.6
 zephyrproject-rtos#14 0x0000000000404e9e in _start ()
--------------------------->8--------------------------

That happens because we used to have ".checksum_memory" undefined
for ARC. And it was undefined on purpose as we never got to implement
a target-executed applet for CRC calculation.

But there seems to be a work-around of using real memory read back
via JTAG. And for that we just need to return anything != ERROR_OK
from ".checksum_memory()" callback. Which we do here.

Now image verification works for ARC as well!

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
galak pushed a commit that referenced this pull request Nov 10, 2021
In zephyrproject-rtos/zephyr#35284 it was
found that use of "verify_image" command for ARC boards lead to
OpenOCD segfault:
--------------------------->8--------------------------
 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000000000 in ?? ()
 (gdb) bt
 #0  0x0000000000000000 in ?? ()
 #1  0x0000000000455e27 in target_checksum_memory (target=target@entry=0xa52450, address=2415919104, size=19952, crc=crc@entry=0x7fffffffcf64) at src/target/target.c:2522
 #2  0x0000000000456066 in handle_verify_image_command_internal (cmd=0x7fffffffd040, verify=IMAGE_VERIFY) at src/target/target.c:3846
 #3  0x000000000047e4ca in run_command (num_words=2, words=0xa80800, c=0x9f3ea0, context=0x9a7010) at src/helper/command.c:582
 #4  exec_command (argv=0x7fffffffd140, argc=<optimized out>, c=0x9f3ea0, cmd_ctx=0x9a7010, interp=0x9a7070) at src/helper/command.c:950
 #5  jim_command_dispatch (interp=0x9a7070, argc=<optimized out>, argv=0x7fffffffd140) at src/helper/command.c:1001
 #6  0x00000000005b839a in JimInvokeCommand (interp=interp@entry=0x9a7070, objc=objc@entry=2, objv=objv@entry=0x7fffffffd140) at jim.c:10514
 #7  0x00000000005b8fbc in Jim_EvalObj (interp=interp@entry=0x9a7070, scriptObjPtr=scriptObjPtr@entry=0x9e96d0) at jim.c:11006
 #8  0x00000000005bb12b in Jim_EvalSource (interp=interp@entry=0x9a7070, filename=filename@entry=0x0, lineno=lineno@entry=0,
     script=script@entry=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at jim.c:11298
 #9  0x000000000047df5f in command_run_line (context=context@entry=0x9a7010, line=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at src/helper/command.c:626
 #10 0x000000000047f6b8 in parse_config_file (cmd_ctx=cmd_ctx@entry=0x9a7010) at src/helper/configuration.c:136
 #11 0x00000000004053ae in openocd_thread (cmd_ctx=0x9a7010, argv=0x7fffffffd378, argc=18) at src/openocd.c:296
 #12 openocd_main (argc=18, argv=0x7fffffffd378) at src/openocd.c:356
 #13 0x00007ffff710d505 in __libc_start_main () from /lib64/libc.so.6
 #14 0x0000000000404e9e in _start ()
--------------------------->8--------------------------

That happens because we used to have ".checksum_memory" undefined
for ARC. And it was undefined on purpose as we never got to implement
a target-executed applet for CRC calculation.

But there seems to be a work-around of using real memory read back
via JTAG. And for that we just need to return anything != ERROR_OK
from ".checksum_memory()" callback. Which we do here.

Now image verification works for ARC as well!

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
aaillet pushed a commit to iotbzh/openocd that referenced this pull request May 9, 2022
In zephyrproject-rtos/zephyr#35284 it was
found that use of "verify_image" command for ARC boards lead to
OpenOCD segfault:
--------------------------->8--------------------------
 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000000000 in ?? ()
 (gdb) bt
 #0  0x0000000000000000 in ?? ()
 zephyrproject-rtos#1  0x0000000000455e27 in target_checksum_memory (target=target@entry=0xa52450, address=2415919104, size=19952, crc=crc@entry=0x7fffffffcf64) at src/target/target.c:2522
 zephyrproject-rtos#2  0x0000000000456066 in handle_verify_image_command_internal (cmd=0x7fffffffd040, verify=IMAGE_VERIFY) at src/target/target.c:3846
 zephyrproject-rtos#3  0x000000000047e4ca in run_command (num_words=2, words=0xa80800, c=0x9f3ea0, context=0x9a7010) at src/helper/command.c:582
 zephyrproject-rtos#4  exec_command (argv=0x7fffffffd140, argc=<optimized out>, c=0x9f3ea0, cmd_ctx=0x9a7010, interp=0x9a7070) at src/helper/command.c:950
 zephyrproject-rtos#5  jim_command_dispatch (interp=0x9a7070, argc=<optimized out>, argv=0x7fffffffd140) at src/helper/command.c:1001
 zephyrproject-rtos#6  0x00000000005b839a in JimInvokeCommand (interp=interp@entry=0x9a7070, objc=objc@entry=2, objv=objv@entry=0x7fffffffd140) at jim.c:10514
 zephyrproject-rtos#7  0x00000000005b8fbc in Jim_EvalObj (interp=interp@entry=0x9a7070, scriptObjPtr=scriptObjPtr@entry=0x9e96d0) at jim.c:11006
 zephyrproject-rtos#8  0x00000000005bb12b in Jim_EvalSource (interp=interp@entry=0x9a7070, filename=filename@entry=0x0, lineno=lineno@entry=0,
     script=script@entry=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at jim.c:11298
 zephyrproject-rtos#9  0x000000000047df5f in command_run_line (context=context@entry=0x9a7010, line=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at src/helper/command.c:626
 zephyrproject-rtos#10 0x000000000047f6b8 in parse_config_file (cmd_ctx=cmd_ctx@entry=0x9a7010) at src/helper/configuration.c:136
 zephyrproject-rtos#11 0x00000000004053ae in openocd_thread (cmd_ctx=0x9a7010, argv=0x7fffffffd378, argc=18) at src/openocd.c:296
 zephyrproject-rtos#12 openocd_main (argc=18, argv=0x7fffffffd378) at src/openocd.c:356
 zephyrproject-rtos#13 0x00007ffff710d505 in __libc_start_main () from /lib64/libc.so.6
 zephyrproject-rtos#14 0x0000000000404e9e in _start ()
--------------------------->8--------------------------

That happens because we used to have ".checksum_memory" undefined
for ARC. And it was undefined on purpose as we never got to implement
a target-executed applet for CRC calculation.

But there seems to be a work-around of using real memory read back
via JTAG. And for that we just need to return anything != ERROR_OK
from ".checksum_memory()" callback. Which we do here.

Now image verification works for ARC as well!

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
stephanosio pushed a commit that referenced this pull request Jun 14, 2022
In zephyrproject-rtos/zephyr#35284 it was
found that use of "verify_image" command for ARC boards lead to
OpenOCD segfault:
--------------------------->8--------------------------
 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000000000 in ?? ()
 (gdb) bt
 #0  0x0000000000000000 in ?? ()
 #1  0x0000000000455e27 in target_checksum_memory (target=target@entry=0xa52450, address=2415919104, size=19952, crc=crc@entry=0x7fffffffcf64) at src/target/target.c:2522
 #2  0x0000000000456066 in handle_verify_image_command_internal (cmd=0x7fffffffd040, verify=IMAGE_VERIFY) at src/target/target.c:3846
 #3  0x000000000047e4ca in run_command (num_words=2, words=0xa80800, c=0x9f3ea0, context=0x9a7010) at src/helper/command.c:582
 #4  exec_command (argv=0x7fffffffd140, argc=<optimized out>, c=0x9f3ea0, cmd_ctx=0x9a7010, interp=0x9a7070) at src/helper/command.c:950
 #5  jim_command_dispatch (interp=0x9a7070, argc=<optimized out>, argv=0x7fffffffd140) at src/helper/command.c:1001
 #6  0x00000000005b839a in JimInvokeCommand (interp=interp@entry=0x9a7070, objc=objc@entry=2, objv=objv@entry=0x7fffffffd140) at jim.c:10514
 #7  0x00000000005b8fbc in Jim_EvalObj (interp=interp@entry=0x9a7070, scriptObjPtr=scriptObjPtr@entry=0x9e96d0) at jim.c:11006
 #8  0x00000000005bb12b in Jim_EvalSource (interp=interp@entry=0x9a7070, filename=filename@entry=0x0, lineno=lineno@entry=0,
     script=script@entry=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at jim.c:11298
 #9  0x000000000047df5f in command_run_line (context=context@entry=0x9a7010, line=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at src/helper/command.c:626
 #10 0x000000000047f6b8 in parse_config_file (cmd_ctx=cmd_ctx@entry=0x9a7010) at src/helper/configuration.c:136
 #11 0x00000000004053ae in openocd_thread (cmd_ctx=0x9a7010, argv=0x7fffffffd378, argc=18) at src/openocd.c:296
 #12 openocd_main (argc=18, argv=0x7fffffffd378) at src/openocd.c:356
 #13 0x00007ffff710d505 in __libc_start_main () from /lib64/libc.so.6
 #14 0x0000000000404e9e in _start ()
--------------------------->8--------------------------

That happens because we used to have ".checksum_memory" undefined
for ARC. And it was undefined on purpose as we never got to implement
a target-executed applet for CRC calculation.

But there seems to be a work-around of using real memory read back
via JTAG. And for that we just need to return anything != ERROR_OK
from ".checksum_memory()" callback. Which we do here.

Now image verification works for ARC as well!

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
stephanosio pushed a commit to stephanosio/zephyr-openocd that referenced this pull request Jun 14, 2022
In zephyrproject-rtos/zephyr#35284 it was
found that use of "verify_image" command for ARC boards lead to
OpenOCD segfault:
--------------------------->8--------------------------
 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000000000 in ?? ()
 (gdb) bt
 #0  0x0000000000000000 in ?? ()
 zephyrproject-rtos#1  0x0000000000455e27 in target_checksum_memory (target=target@entry=0xa52450, address=2415919104, size=19952, crc=crc@entry=0x7fffffffcf64) at src/target/target.c:2522
 zephyrproject-rtos#2  0x0000000000456066 in handle_verify_image_command_internal (cmd=0x7fffffffd040, verify=IMAGE_VERIFY) at src/target/target.c:3846
 zephyrproject-rtos#3  0x000000000047e4ca in run_command (num_words=2, words=0xa80800, c=0x9f3ea0, context=0x9a7010) at src/helper/command.c:582
 zephyrproject-rtos#4  exec_command (argv=0x7fffffffd140, argc=<optimized out>, c=0x9f3ea0, cmd_ctx=0x9a7010, interp=0x9a7070) at src/helper/command.c:950
 zephyrproject-rtos#5  jim_command_dispatch (interp=0x9a7070, argc=<optimized out>, argv=0x7fffffffd140) at src/helper/command.c:1001
 zephyrproject-rtos#6  0x00000000005b839a in JimInvokeCommand (interp=interp@entry=0x9a7070, objc=objc@entry=2, objv=objv@entry=0x7fffffffd140) at jim.c:10514
 zephyrproject-rtos#7  0x00000000005b8fbc in Jim_EvalObj (interp=interp@entry=0x9a7070, scriptObjPtr=scriptObjPtr@entry=0x9e96d0) at jim.c:11006
 zephyrproject-rtos#8  0x00000000005bb12b in Jim_EvalSource (interp=interp@entry=0x9a7070, filename=filename@entry=0x0, lineno=lineno@entry=0,
     script=script@entry=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at jim.c:11298
 zephyrproject-rtos#9  0x000000000047df5f in command_run_line (context=context@entry=0x9a7010, line=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at src/helper/command.c:626
 zephyrproject-rtos#10 0x000000000047f6b8 in parse_config_file (cmd_ctx=cmd_ctx@entry=0x9a7010) at src/helper/configuration.c:136
 zephyrproject-rtos#11 0x00000000004053ae in openocd_thread (cmd_ctx=0x9a7010, argv=0x7fffffffd378, argc=18) at src/openocd.c:296
 zephyrproject-rtos#12 openocd_main (argc=18, argv=0x7fffffffd378) at src/openocd.c:356
 zephyrproject-rtos#13 0x00007ffff710d505 in __libc_start_main () from /lib64/libc.so.6
 zephyrproject-rtos#14 0x0000000000404e9e in _start ()
--------------------------->8--------------------------

That happens because we used to have ".checksum_memory" undefined
for ARC. And it was undefined on purpose as we never got to implement
a target-executed applet for CRC calculation.

But there seems to be a work-around of using real memory read back
via JTAG. And for that we just need to return anything != ERROR_OK
from ".checksum_memory()" callback. Which we do here.

Now image verification works for ARC as well!

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
stephanosio pushed a commit that referenced this pull request Jun 14, 2022
In zephyrproject-rtos/zephyr#35284 it was
found that use of "verify_image" command for ARC boards lead to
OpenOCD segfault:
--------------------------->8--------------------------
 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000000000 in ?? ()
 (gdb) bt
 #0  0x0000000000000000 in ?? ()
 #1  0x0000000000455e27 in target_checksum_memory (target=target@entry=0xa52450, address=2415919104, size=19952, crc=crc@entry=0x7fffffffcf64) at src/target/target.c:2522
 #2  0x0000000000456066 in handle_verify_image_command_internal (cmd=0x7fffffffd040, verify=IMAGE_VERIFY) at src/target/target.c:3846
 #3  0x000000000047e4ca in run_command (num_words=2, words=0xa80800, c=0x9f3ea0, context=0x9a7010) at src/helper/command.c:582
 #4  exec_command (argv=0x7fffffffd140, argc=<optimized out>, c=0x9f3ea0, cmd_ctx=0x9a7010, interp=0x9a7070) at src/helper/command.c:950
 #5  jim_command_dispatch (interp=0x9a7070, argc=<optimized out>, argv=0x7fffffffd140) at src/helper/command.c:1001
 #6  0x00000000005b839a in JimInvokeCommand (interp=interp@entry=0x9a7070, objc=objc@entry=2, objv=objv@entry=0x7fffffffd140) at jim.c:10514
 #7  0x00000000005b8fbc in Jim_EvalObj (interp=interp@entry=0x9a7070, scriptObjPtr=scriptObjPtr@entry=0x9e96d0) at jim.c:11006
 #8  0x00000000005bb12b in Jim_EvalSource (interp=interp@entry=0x9a7070, filename=filename@entry=0x0, lineno=lineno@entry=0,
     script=script@entry=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at jim.c:11298
 #9  0x000000000047df5f in command_run_line (context=context@entry=0x9a7010, line=0x9e0db0 "verify_image build/zephyr/zephyr.elf") at src/helper/command.c:626
 #10 0x000000000047f6b8 in parse_config_file (cmd_ctx=cmd_ctx@entry=0x9a7010) at src/helper/configuration.c:136
 #11 0x00000000004053ae in openocd_thread (cmd_ctx=0x9a7010, argv=0x7fffffffd378, argc=18) at src/openocd.c:296
 #12 openocd_main (argc=18, argv=0x7fffffffd378) at src/openocd.c:356
 #13 0x00007ffff710d505 in __libc_start_main () from /lib64/libc.so.6
 #14 0x0000000000404e9e in _start ()
--------------------------->8--------------------------

That happens because we used to have ".checksum_memory" undefined
for ARC. And it was undefined on purpose as we never got to implement
a target-executed applet for CRC calculation.

But there seems to be a work-around of using real memory read back
via JTAG. And for that we just need to return anything != ERROR_OK
from ".checksum_memory()" callback. Which we do here.

Now image verification works for ARC as well!

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants