[PATCH] ARM: Add support for semihosting

Sascha Hauer s.hauer at pengutronix.de
Mon Oct 19 00:36:43 PDT 2015


Hi Andrey,

On Sun, Oct 18, 2015 at 10:33:57PM -0700, Andrey Smirnov wrote:
> Add semihosting API implementation and implement a filesystem driver
> to access debugging host filesystem using it.

Neat. I didn't know semihosting can be used for file transfer.

> +File I/O over ARM semihosting support
> +=====================================
> +
> +barebox can communicate with debug programms attached via SWD/JTAG by
> +means of ARM semihosting protocol.
> +
> +Not all of the I/O primitives neccessary to implement a full
> +filesystem are exposed in ARM semihosting API and because of that some
> +aspects of filesystem funcionality are missing. Implementation does
> +not have support for listing directories. This means a
> +:ref:`command_ls` to a SMHFS-mounted path will show an empty
> +directory. Nevertheless, the files are there.

Is adding ls support a matter of implementing it? Does the semihosting
protocol support ls?

> +
> +Example::
> +
> +  mount -t smhfs /dev/null /mnt/smhfs

Are actions on the host required to do that? Maybe some example for
using this with openocd would be useful.

> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 304b6e6..1bccca3 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -326,6 +326,15 @@ config ARM_UNWIND
>  	  the performance is not affected. Currently, this feature
>  	  only works with EABI compilers. If unsure say Y.
> 
> +config ARM_SEMIHOSTING
> +	bool "enable ARM semihosting support"
> +	help
> +	  This option enables ARM semihosting support in barebox. ARM
> +	  semihosting is a communication discipline that allows code
> +	  running on target ARM cpu perform system calls and access
> +	  the data on the host computer connected to the target via
> +	  debugging channel (JTAG, SWD). If unsure say N
> +
>  endmenu
> 

> +static int smhfs_remove(struct device_d __always_unused *dev,
> +			const char *pathname)
> +{
> +	/* Get rid of leading '/' */
> +	pathname = &pathname[1];
> +
> +	if (semihosting_remove(pathname) != 0)
> +		return semihosting_errno();

Are the errnos semihosting returns compatible with the barebox errnos?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list