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

printf() for %f is broken since one of the last merges #1

Closed
LorenzMeier opened this issue Aug 15, 2012 · 3 comments
Closed

printf() for %f is broken since one of the last merges #1

LorenzMeier opened this issue Aug 15, 2012 · 3 comments
Assignees
Labels

Comments

@LorenzMeier
Copy link
Member

Output of tests float:


nsh> tests float

--- SINGLE PRECISION TESTS ---
The single precision test involves calls to fabsf(),
if test fails check this function as well.

         success: sinf(0.0f) == 0.0f
         success: sinf(1.0f) == 0.84147f
         success: asinf(1.0f) == 1.57079f
         success: cosf(1.0f) == 0.54030f
         success: acosf(1.0f) == 0.0f
         success: sinf(0.1f) == 0.09983f
         success: sqrt(2.0f) == 1.41421f
         success: atan2f(1.0f, 1.0f) == 0.78539f
         FAIL: printf("%8.4f", 0.553415f) != "  0.5534", result:   0.0g34

--- DOUBLE PRECISION TESTS ---
         success: 1.0111 * 2.0 == 2.0222
         success: (float) 1.55f == 1.55 (double)
         success: sin(0.0) == 0.0
         success: sin(1.0) == 0.84147098480
         success: atan2(1.0, 1.0) == 0.785398
         testing pow() with magic value
           (44330.0 * (1.0 - pow((96286LL / 101325.0), 0.190295)));
         success: result: 0Z8.2293
         FAIL: printf("%8.4f", 0.553415) != "  0.5534", result:   0.0g34

 FAIL: One or more tests failed.
@ghost ghost assigned px4dev Aug 15, 2012
@px4dev
Copy link
Contributor

px4dev commented Aug 15, 2012

I can't reproduce this with a clean build of master:

gcc version 4.6.2 20120613 (release) [ARM/embedded-4_6-branch revision 188521](GNU Tools for ARM Embedded Processors)

nsh> tests float

--- SINGLE PRECISION TESTS ---
The single precision test involves calls to fabsf(),
if test fails check this function as well.

 success: sinf(0.0f) == 0.0f
 success: sinf(1.0f) == 0.84147f
 success: asinf(1.0f) == 1.57079f
 success: cosf(1.0f) == 0.54030f
 success: acosf(1.0f) == 0.0f
 success: sinf(0.1f) == 0.09983f
 success: sqrt(2.0f) == 1.41421f
 success: atan2f(1.0f, 1.0f) == 0.78539f
 success: printf("%8.4f", 0.553415f) ==   0.5534

--- DOUBLE PRECISION TESTS ---
success: 1.0111 * 2.0 == 2.0222
success: (float) 1.55f == 1.55 (double)
success: sin(0.0) == 0.0
success: sin(1.0) == 0.84147098480
success: atan2(1.0, 1.0) == 0.785398
testing pow() with magic value
(44330.0 * (1.0 - pow((96286LL / 101325.0), 0.190295)));
success: result: 428.2293
success: printf("%8.4f", 0.553415) == 0.5534

SUCCESS: All float and double tests passed.

@LorenzMeier
Copy link
Member Author

Still had this old GCC somehow, upgrading now and re-testing

arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.6.2 20110921 (release) [ARM/embedded-4_6-branch revision 182083]

@LorenzMeier
Copy link
Member Author

With the new gcc this issue vanished - seems to be a compiler bug. Closing.

arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.6.2 20120613 (release) [ARM/embedded-4_6-branch revision 188521]
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LorenzMeier added a commit that referenced this issue Nov 5, 2012
geeksville pushed a commit to geeksville/PX4Firmware that referenced this issue Aug 10, 2013
Add more performance counters; run test PX4#1 faster.
thomasgubler added a commit that referenced this issue Jan 11, 2014
LorenzMeier added a commit that referenced this issue May 13, 2014
Output a debug string is Invalid @ parameter #1
LorenzMeier pushed a commit that referenced this issue Mar 6, 2015
LorenzMeier pushed a commit that referenced this issue Apr 24, 2015
Order fixed for vision position quaternion
mhkabir referenced this issue in mhkabir/Firmware May 26, 2015
mcharleb referenced this issue Jun 4, 2015
GCC 4.8 and higher implement 16 byte static data alignment on 64-bit.
This means that the 24-byte param_info_s variables are 16 byte aligned
by GCC and that messes up the assumption that the address of the second
parameter is at &param[0]+sizeof(param[0]).
When compiled with clang it is true, with gcc is is not true.

See https://llvm.org/bugs/show_bug.cgi?format=multiple&id=18006

The fix is needed for GCC >=4.8 only. Clang works fine without this.

Added __attribute__((aligned(16))) to first member of param_info_s.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
gary9555 added a commit to 13rianK/Firmware that referenced this issue Jul 31, 2015
gary9555 added a commit to 13rianK/Firmware that referenced this issue Jul 31, 2015
scott-eddy pushed a commit to scott-eddy/Firmware that referenced this issue Dec 11, 2015
aruizgarcia pushed a commit to aruizgarcia/Firmware that referenced this issue Jun 9, 2021
dagar pushed a commit that referenced this issue Nov 16, 2021
Changed root dir for coverage.
potaito pushed a commit that referenced this issue Apr 1, 2022
Auto merge of current PX4 Master
This was referenced May 9, 2022
salvamarce referenced this issue in salvamarce/PX4-Autopilot Apr 14, 2023
LetMeSeeThatCode pushed a commit to LetMeSeeThatCode/PX4-Autopilot that referenced this issue Feb 19, 2024
m1kelyons added a commit to m1kelyons/PX4-Autopilot that referenced this issue Jan 30, 2025
This solution (PX4#1) uses integration of the acceleration from the vehicle_imu uORB topic. Conversions are made using the description of the units found in the VehicleIMU.msg as a reference.
1. New custom Module "mike_velocity_logger"
2. Module Starts on initialization through rcS
3. Only for px4-sitl build targed, enabled by default
4. Only Publishes when Armed and runs at 10 Hz.
5. Logger is set to log these topics at 10 Hz (100 ms).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants