ARMmbed / ARMmbed/mbed-drivers

Support for semihosting

Open
#188 3 comments 5 reactions 0 assignees View on GitHub
mirrored
Dominant language
C++
Stars
39
Forks
41
PR merge metrics
No merged PRs in 30d

Description

It would be nice to allow support for semihosting for targets that have no serial output possibilities. In order to achieve that, one needs to add **--specs=rdimon.specs** to the linker options. But then since the low-level functions defined in rdimon.specs are already defined in retarget.cpp, the program will not compile or work. These functions are:
- _lseek
- _isatty
- _open
- _close

I can see that in device.h file of some mbed-hal-\* modules, **DEVICE_SEMIHOST** exists but it doesn't seem to have been used at all. One suggestion that I've tried and worked is to #if !DEVICE_SEMIHOST the definitions of those functions out. The two functions below are also necessary to exclude for semihosting to work correctly:
- _read
- _write

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with retarget.cpp and the device.h files in the mbed-hal-* modules, then inspect how DEVICE_SEMIHOST is defined or consumed. Verify the --specs=rdimon.specs linker path and the listed low-level functions, including _read and _write. Done means semihosting targets compile and work without conflicting retarget definitions, while other targets retain their normal serial behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.