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

Not supported on nRF9160 using the Nordic NRF Connect SDK / arm-none-eabi-gcc compiler #20

Open
hraftery opened this issue May 12, 2021 · 0 comments

Comments

@hraftery
Copy link

I tried to use debugbreak.h in a "SEGGER Embedded Studio for ARM (Nordic Edition)" project, built using the NRF Connect SDK (NCS), which ultimately uses the arm-none-eabi gcc toolchain. I happen to be targeting an nRF9160.

It built, but the resulting code was considered an "invalid opcode" and would cause a hard-fault if executed. So while the debugger would be triggered, there was no useful program counter, stack frame or other debuggable information.

I believe the path that gets built in that environment is this one:

	/* 'eabi_linux_thumb_le_breakpoint' */
	__asm__ volatile(".inst 0xde01");

In the end, this alternate did work. I derived it from some other mysterious Nordic library, where it is referred to as NRF_BREAKPOINT:

#if defined(__GNUC__)
    __asm__("BKPT 0");
#else
    __BKPT(0)
#endif

It looks like this may be useful on other platforms too. I don't know why the environment detection in debugbreak didn't work in the first place, so I'm not sure how you'd merge it. But if you're interested, I can do some experimentation to help you figure it out.

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

No branches or pull requests

1 participant