DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • How to Debug the Spring Boot Application in Eclipse? [Video]
  • Creating a Web Project: Key Steps to Identify Issues
  • Kubernetes Ephemeral Containers: Enhancing Security and Streamlining Troubleshooting in Production Clusters
  • Simplify NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3

Trending

  • DZone's Article Submission Guidelines
  • How Large Tech Companies Architect Resilient Systems for Millions of Users
  • The Modern Data Stack Is Overrated — Here’s What Works
  • Unlocking AI Coding Assistants Part 4: Generate Spring Boot Application
  1. DZone
  2. Coding
  3. Frameworks
  4. Semihosting with GNU ARM Embedded (LaunchPad) and GNU ARM Eclipse Debug Plugins

Semihosting with GNU ARM Embedded (LaunchPad) and GNU ARM Eclipse Debug Plugins

By 
Erich Styger user avatar
Erich Styger
·
Sep. 17, 14 · Interview
Likes (0)
Comment
Save
Tweet
Share
8.2K Views

Join the DZone community and get the full member experience.

Join For Free

in “ semihosting with kinetis design studio ” i used printf() to exchange text and data between the target board and the host using the debug connection. kinetis design studio (kds) has that semihosting baked into its libraries. what about if using the gnu arm embedded (launchpad) tools and libraries (see “ switching arm gnu tool chain and libraries in kinetis design studio “)? actually it requires two more steps, but is very easy too.

semihosting output

semihosting output

there are three things to be in place to use semihosting with the gnu arm embedded (launchpad) libraries:

  1. option in the gnu linker settings
  2. enabling semihosting in the debugger settings
  3. initializing the gnu libraries

linker option

to enable semihosting for the gnu arm embedded ( launchpad ) libraries, i need to add

--specs=rdimon.specs 

to the linker options:

linker option to enable semihosting

linker option to enable semihosting

in case i’m using newlib-nano and want to use printf() and/or scanf() with floating point support, i need to pull in some symbols explicitly with the linker options ‘u':

-u _scanf_float
-u _printf_float 


debugger settings

in the gnu arm eclipse plugins, i need to enable semihosting.

segger j-link

for segger j-link, i enable the console in the launch configuration:

allocated semihosting console for segger

allocated semihosting console for segger


additionally i enable semihosting options in the startup options of the debugger:


enabled semihosting in the startup options for segger

enabled semihosting in the startup options for segger


p&e multilink

for p&e the following settings are used:

semihosting settings for pne

semihosting settings for pne


settings for openocd

the following settings are used for openocd:

openocd semihosting settings

openocd semihosting settings

initializing the gnu libraries

if you would now try to use semihosting with running the debugger, you probably will get error messages like this (e.g. from segger j-link):

warning: semihosting command sys_flen failed. handle is 0.
warning: semihosting command sys_write failed. handle is 0.
warning: semihosting command sys_write failed. handle is 0.
warning: semihosting command sys_write failed. handle is 0. 

the reason is that the semihosting needs to be enabled by the application. i need to call initialise_monitor_handles() before i’m using printf() :

1
2
3
4
5
6
7
8
extern void initialise_monitor_handles( void ); /* prototype */
int main( void ) {
initialise_monitor_handles(); /* initialize handles */
for (;;) {
printf ( "hello world!\r\n" );
}
}


with this, i can use printf() and scanf() through a debugger connection.


semihosting printf output

semihosting printf output

summary

while i don’t like printf() for many reasons, sometimes it is useful to exchange data with the host. using semihosting no physical connection is required, as the communication goes through the debugger. it is somewhat intrusive, and adds code and data overhead, but the gnu arm embedded (launchpad) libraries (both newlib and newlib-nano) have semihosting built-in. it is a matter to enable it in the linker and debugger settings, and to initialize the handles in the application.

happy semihosting :-)

GNU Arm (geography) Debug (command) Eclipse Launchpad (macOS)

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How to Debug the Spring Boot Application in Eclipse? [Video]
  • Creating a Web Project: Key Steps to Identify Issues
  • Kubernetes Ephemeral Containers: Enhancing Security and Streamlining Troubleshooting in Production Clusters
  • Simplify NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!