Skip to content

Instantly share code, notes, and snippets.

@artizirk
Created December 7, 2020 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artizirk/82c4190f45017d8befcff45c0984b3ab to your computer and use it in GitHub Desktop.
Save artizirk/82c4190f45017d8befcff45c0984b3ab to your computer and use it in GitHub Desktop.
openocd: arm semihosting enable; reset run
void __attribute__ ((noinline)) print_semihosting(const void *buf, uint32_t size)
{
uint32_t args[3];
args[0] = 1;
args[1] = (uint32_t)buf;
args[2] = size;
asm( "mov r0, #5\n"
"mov r1, %0\n"
"bkpt 0x00AB" : : "r"(args) : "r0", "r1", "memory");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment