Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToString() causing hardfault #416

Closed
josesimoes opened this issue Sep 19, 2018 · 1 comment · Fixed by nanoframework/nf-interpreter#933
Closed

ToString() causing hardfault #416

josesimoes opened this issue Sep 19, 2018 · 1 comment · Fixed by nanoframework/nf-interpreter#933

Comments

@josesimoes
Copy link
Member

Details about Problem

nanoFramework area (Hardware/target board )

Detailed repro steps so we can see the same problem

  1. The following code causes a hard fault on STM32
    ((long)-1234567899876543210).ToString("X16")
@sharmavishnu
Copy link

Additional Information

Performed a few tests on .NET Core 2.0 and nanoFramework. (This test was performed on build using files from repo on 9-Oct-18 and tried on STM32F401RE Nucleo board). Here are the results. See if this helps:

Test 1
.NET Core 2.0
long test = 32769;
string asStr = test.ToString("X7");
//String returned is 0x0008001 -- Correct

nanoFramework
long test = 32769;
string asStr = test.ToString("X7");
//String returned is 0x8001000 -- Incorrect

Test 2
.NET Core 2.0
long test = 64435;
string asStr = test.ToString("X8");
//String returned is 0x0000FBB3 -- Correct

nanoFramework
long test = 32769;
string asStr = test.ToString("X8");
//String returned is 0xFBB30000 -- Incorrect

Test 3
.NET Core 2.0
long test = 4294967294;
string asStr = test.ToString("X8");
//String returned is 0xFFFFFFFE -- Correct

nanoFramework
long test = 4294967294;
string asStr = test.ToString("X8");
//String returned is 0xFFFFFFFE -- Correct

Test 4
.NET Core 2.0
long test = 4294967294;
string asStr = test.ToString("X9");
//String returned is 0x0FFFFFFFE -- Correct

nanoFramework
long test = 4294967294;
string asStr = test.ToString("X9");
//String returned is 0xFFFFFFFE0 -- Incorrect

Test 5
.NET Core 2.0
long test = 4294967294;
string asStr = test.ToString("X10");
//String returned is 0x00FFFFFFFE -- Correct

nanoFramework
long test = 4294967294;
string asStr = test.ToString("X10");
//Debugger hangs...causes hardfault. Only way to recover is to re-flash hex files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants