Closed pilotak closed 4 years ago
Additional details:
NUCLEO_F091RC
is Cortex-M0 and NUCLEO_F412ZG
is Cortex M4F.
Can you test std library (see https://github.com/ARMmbed/mbed-os/blob/master/platform/source/minimal-printf/README.md) to confirm this is an issue with minimal printf implementation?
It's not related to printf
(although i have tried "target.printf_lib": "std"
as well)
If I alter the code to following, the error is still there
void pass(const unsigned char *t) {
unsigned short var = *(unsigned short *)(t + 1);
if (var == 1) {
printf("yes\n");
} else {
printf("no\n");
}
}
@pilotak thank you for raising this issue.Please take a look at the following comments:
We cannot automatically identify a release based on the version of Mbed OS that you have provided. Please provide either a single valid sha of the form #abcde12 or #3b8265d70af32261311a06e423ca33434d8d80de or a single valid release tag of the form mbed-os-x.y.z . E.g. 'mbed-os-99.99.99' signifies master branch and is not a unique single snapshot. NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'.This indicates to us that at least all the fields have been considered. Please update the issue header with the missing information, the issue will not be mirroredto our internal defect tracking system or investigated until this has been fully resolved.
I see now.
You are getting a hard fault but due to misaligned access. Cortex M3/M4 tolerate it, but M0 does not. You have 8bit buffer but accessing it via casting to 16bit pointer.
Check The Definitive Guide to the ARM Cortex-M0
, page 83 for details.
I'll close this as resolved.
Ok, thank you I did know that
Description of defect
When running code bellow on F091 there is always following error: functions
pass()
is the problem, exactly the part where i try to read fromdata
no matter if it's inprintf
or assigned to a variable.If this code is run on NUCLEO_F412ZG there is no problem.
Target(s) affected by this defect ?
NUCLEO_F091RC
Toolchain(s) (name and version) displaying this defect ?
GCC_ARM
What version of Mbed-os are you using (tag or sha) ?
a6207cadad0acd1876f436dc6baeddf46c42af06
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
mbed-cli
How is this defect reproduced ?