arm: add support for semihosting for ARMv7M targets
PATCH 1/1 arm: add support for semihosting for ARMv7M targets
It is possible to enable CONFIG_SEMIHOSTING for STM32F429 target, but it would result in compile error. This patch adds support for semihosting for STM32F429 or any other ARMv7M target. Tested on STM32F429-DISCOVERY board.
---
arch/arm/lib/semihosting.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/lib/semihosting.c +4 -2
@@ -31,6 +31,8 @@ static noinline long smh_trap(unsigned int sysnum, void *addr) registerlong result asm("r0" );#if defined(CONFIG_ARM64 ) asmvolatile ("hlt #0xf000" :"=r" (result) :"0" (sysnum),"r" (addr)); +#elif defined(CONFIG_CPU_V7M ) + asmvolatile ("bkpt #0xAB" :"=r" (result) :"0" (sysnum),"r" (addr));#else /* Note - untested placeholder */ asmvolatile ("svc #0x123456" :"=r" (result) :"0" (sysnum),"r" (addr));
@@ -90,7 +92,7 @@ static long smh_read(long fd, void *memp, size_t len)size_t len; } read; -debug ("%s: fd %ld, memp %p, len %lu\n" , __func__, fd, memp, len); +debug ("%s: fd %ld, memp %p, len %lu\n" , __func__, fd, memp, (ulong )len); read.fd = fd; read.memp = memp;
@@ -105,7 +107,7 @@ static long smh_read(long fd, void *memp, size_t len)* with an error message. */ printf ("%s: ERROR ret %ld, fd %ld, len %lu memp %p\n" , - __func__, ret, fd, len, memp); + __func__, ret, fd, (ulong )len, memp);return -1 ; }
Signature · 1 line
2.6.1
PATCH 1/1 arm: add support for semihosting for ARMv7M targets
Quoted 5 lines · Vadzim Dambrouski
It is possible to enable
CONFIG_SEMIHOSTINGfor STM32F429 target, but it would result in compile error. This patch adds support for semihosting for STM32F429 or any other ARMv7M target. Tested on STM32F429-DISCOVERY board.Signed-off-by Vadzim Dambrouski <[email protected]>
Hey, cool. Technically the (ulong) typecasts should be another patch but I don't care too much.
Are you using this with the smload commands?
Yours,
Linus Walleij
PATCH 1/1 arm: add support for semihosting for ARMv7M targets
Quoted 1 line · Linus Walleij
Hey, cool. Technically the (ulong) typecasts should be another patch
Sorry about that, this is my first time sending a patch.
Quoted 1 line
Are you using this with the smload commands?
Yes, I do use smhload command, and openocd on the other end. Useful for debugging targets without ethernet support.
PATCH 1/1 arm: add support for semihosting for ARMv7M targets
Hello Vadzim,
Quoted 4 lines · Vadzim Dambrouski
Quoted 1 line · Linus Walleij
Hey, cool. Technically the (ulong) typecasts should be another patch
Sorry about that, this is my first time sending a patch.
Would you mind resending as two different patches then?
Quoted 4 lines
Quoted 1 line
Are you using this with the smload commands?
Yes, I do use smhload command, and openocd on the other end. Useful for debugging targets without ethernet support.
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 arm: add support for semihosting for ARMv7M targets
In reply to Vadzim DambrouskiQuoted 9 lines · Vadzim Dambrouski
Quoted 1 line · Linus Walleij
Hey, cool. Technically the (ulong) typecasts should be another patch
Sorry about that, this is my first time sending a patch.
Quoted 1 line
Are you using this with the smload commands?
Yes, I do use smhload command, and openocd on the other end. Useful for debugging targets without ethernet support.
That is *so* cool. You should make a blog post about this, I think it's generally useful for developers to know they can use U-Boot+JTAG+OpenOCD to get code into any platform (if they have a scan chain definitions) like this.
Yours,
Linus Walleij
PATCH 1/1 arm: add support for semihosting for ARMv7M targets
Quoted 8 lines · Linus Walleij
Quoted 7 lines · Vadzim Dambrouski
Quoted 1 line · Linus Walleij
Hey, cool. Technically the (ulong) typecasts should be another patch
Sorry about that, this is my first time sending a patch.
Quoted 1 line
Are you using this with the smload commands?
Quoted 7 lines
Quoted 2 lines
Yes, I do use smhload command, and openocd on the other end. Useful for debugging targets without ethernet support.
That is *so* cool. You should make a blog post about this, I think it's generally useful for developers to know they can use U-Boot+JTAG+OpenOCD to get code into any platform (if they have a scan chain definitions) like this.
Yes, please!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151019/2f563644/attachment.sig>
PATCH 1/1 arm: add support for semihosting for ARMv7M targets
Quoted 12 lines · Tom Rini
Quoted 11 lines · Linus Walleij
Quoted 9 lines · Vadzim Dambrouski
Quoted 1 line · Linus Walleij
Hey, cool. Technically the (ulong) typecasts should be another patch
Sorry about that, this is my first time sending a patch.
Quoted 1 line
Are you using this with the smload commands?
Yes, I do use smhload command, and openocd on the other end. Useful for debugging targets without ethernet support.
Quoted 7 lines
Quoted 4 lines
That is *so* cool. You should make a blog post about this, I think it's generally useful for developers to know they can use U-Boot+JTAG+OpenOCD to get code into any platform (if they have a scan chain definitions) like this.
Yes, please!
Sorry, I'm not very good at writing (I don't even have a blog) and there is not much to write about. But I'll consider starting a blog (it may be a good experience for me).
Regards,
Vadzim Dambrouski