Why does semihosting stop working when I add c++ code to the system

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why does semihosting stop working when I add c++ code to the system

831 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modig on Fri Apr 10 02:22:17 MST 2015

I am new to using the LPCXpresso and have a LPCXpresso11U68 which I want to run some c++ code on.

( Uisng version  v.7.7.2_379 )

I created a new c++ project and switched on the newlib adding the following printf statement to to the main routine

while(1) {
i++ ;
if ( i > 10000)
{
printf ( "hello world \n\r");
i =0;
}

This all works well and I see a continous stream of output on the console.

The problem is that when I add some more simple c++ to the system the printf stops working.
This can be only a couple of class declarations.

Does anybody know what causes this or should semihosting work at all in this instance.
0 Kudos
11 Replies

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri May 15 09:54:41 MST 2015
This will be fixed in the next LPCXpresso release, which is currently targeted for the end of May.

Regards,
LPCXpresso Support
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modig on Thu May 14 06:44:17 MST 2015
Any time sclae on this. I have a large amount of c++ code to debug and want to know the best way to proceed.

Many Thanks
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Apr 15 07:44:57 MST 2015
Yes, we have some ideas as to possible causes, but as we stated previously - we are still looking into this.

Regards,
LPCXpresso Support
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modig on Wed Apr 15 07:18:23 MST 2015

The test5.cpp include was just to demo the problem. Any ideas as to the root problem of this.
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Mon Apr 13 04:18:00 MST 2015
Still looking into this, but if you comment out the #include <iostream> in test5.cpp, this will get your printf's working again.

EDIT: #include <iostream> is #include iostream, with iostream surrounded with < and >

Regards,
LPCXpresso Support
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modig on Mon Apr 13 02:11:05 MST 2015

Please find attached a demo which does not work. The main()  should simply perform lots of printfs  as before
but this no longer works when I have added the simple and I think passive file test5.cpp.

If you exclude the "test5.cpp" then the printfs start to work again.   This also appears to happen
with other segments of cpp code. The question is why?

0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Apr 10 08:46:43 MST 2015
No, I did not make any changes. I asked you for a project that exhibited the problem - are you now telling me that the project you provided doesn't?

If you would like me to investigate, please provide a project, together with instructions on how to reproduce the problem.
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modig on Fri Apr 10 08:19:43 MST 2015

Yes it was on a 11u68

Did you try adding some cpp in a separate file ie Something like the following.

Some other cpp if you have it



//
AT_Err::AT_Err()
{
    char buf [100];
    sprintf (buf, " error, errno: 0x%x\n", errnoGet());
    makeCopy (buf);
}

AT_Err::AT_Err(const int err)
{
    char buf [100];
    sprintf (buf, " error, errno: 0x%x\n", err);
    makeCopy (buf);
}

AT_Err::AT_Err(const char *s)
{
    char buf [100];
    sprintf (buf, "%s.  error, errno: 0x%x\n", s, errnoGet());
    makeCopy(buf);
}
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Apr 10 05:59:54 MST 2015
Works perfectly here - I get 100 "xxxxx" followed by a large number of "hello world".

This was running your project to an LPCXpresso11u68 target.
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modig on Fri Apr 10 05:36:29 MST 2015

Please find attached the zip. This is pretty much a standard c++ project with the small chnages to main.
I have switched on semi hosting in the support libraries
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Apr 10 02:42:21 MST 2015
Please export and attach your non-working project to this thread so we can investigate your issue
0 Kudos