Post by whitelion on Jan 18, 2022 8:18:37 GMT
To Whom It May Concern,
I am having trouble using the math.h library for the ShieldBuddy. When using the simple ShieldBuddy skeleton sketch (posted below) I get the following error:
C:\Users\shields\Documents\Arduino\sketches\ShieldBuddy\ShieldBuddy.ino: In function 'void loop()':
ShieldBuddy:36:11: error: 'M_PI' was not declared in this scope
y = cos(M_PI);
^
exit status 1
'M_PI' was not declared in this scope
I should note that I have gone through a recent reinstall of the Aurix Free Toolchain, Arduino IDE and ShieldBuddy IDE along with getting a new license file. This code has compiled before and does compile with the Arduino Due as a target. This suggest that the problem is with the math.h library specific for the ShieldBuddy.
-Joel
Sketch ...
/*** Don't worry, the normal Arduino setup() and loop() are below this block! ***/
/* LMU uninitialised data */
StartOfUninitialised_LMURam_Variables
/* Put your LMU RAM fast access variables that have no initial values here e.g. uint32 LMU_var; */
EndOfUninitialised_LMURam_Variables
/* LMU uninitialised data */
StartOfInitialised_LMURam_Variables
/* Put your LMU RAM fast access variables that have an initial value here e.g. uint32 LMU_var_init = 1; */
EndOfInitialised_LMURam_Variables
/* If you do not care where variables end up, declare them here! */
#include <math.h>
#include <string.h>
//#define M_PI 3.1415
/*** Core 0 ***/
void setup() {
// put your setup code for core 0 here, to run once:
SerialASC.begin(9600);
SerialASC.print("Test ShieldBuddyTC275 RevC (Inside setup) \n");
}
void loop() {
float y = 0.0;
// put your main code for core 0 here, to run repeatedly:
delay(1000);
y = cos(M_PI);
SerialASC.print("Test ShieldBuddyTC275 RevC (Inside loop) \n");
SerialASC.print(y,DEC);
SerialASC.print("\n");
}
/*** Core 1 ***/
/* CPU1 Uninitialised Data */
StartOfUninitialised_CPU1_Variables
/* Put your CPU1 fast access variables that have no initial values here e.g. uint32 CPU1_var; */
EndOfUninitialised_CPU1_Variables
/* CPU1 Initialised Data */
StartOfInitialised_CPU1_Variables
/* Put your CPU1 fast access variables that have an initial value here e.g. uint32 CPU1_var_init = 1; */
EndOfInitialised_CPU1_Variables
void setup1() {
// put your setup code for core 1 here, to run once:
}
void loop1() {
// put your main code for core 1 here, to run repeatedly:
}
/*** Core 2 ***/
/* CPU2 Uninitialised Data */
StartOfUninitialised_CPU2_Variables
/* Put your CPU2 fast access variables that have no initial values here e.g. uint32 CPU2_var; */
EndOfUninitialised_CPU2_Variables
/* CPU2 Initialised Data */
StartOfInitialised_CPU2_Variables
/* Put your CPU2 fast access variables that have an initial value here e.g. uint32 CPU2_var_init = 1; */
EndOfInitialised_CPU2_Variables
void setup2() {
// put your setup code for core 2 here, to run once:
}
void loop2() {
// put your main code for core 2 here, to run repeatedly:
}
I am having trouble using the math.h library for the ShieldBuddy. When using the simple ShieldBuddy skeleton sketch (posted below) I get the following error:
C:\Users\shields\Documents\Arduino\sketches\ShieldBuddy\ShieldBuddy.ino: In function 'void loop()':
ShieldBuddy:36:11: error: 'M_PI' was not declared in this scope
y = cos(M_PI);
^
exit status 1
'M_PI' was not declared in this scope
I should note that I have gone through a recent reinstall of the Aurix Free Toolchain, Arduino IDE and ShieldBuddy IDE along with getting a new license file. This code has compiled before and does compile with the Arduino Due as a target. This suggest that the problem is with the math.h library specific for the ShieldBuddy.
-Joel
Sketch ...
/*** Don't worry, the normal Arduino setup() and loop() are below this block! ***/
/* LMU uninitialised data */
StartOfUninitialised_LMURam_Variables
/* Put your LMU RAM fast access variables that have no initial values here e.g. uint32 LMU_var; */
EndOfUninitialised_LMURam_Variables
/* LMU uninitialised data */
StartOfInitialised_LMURam_Variables
/* Put your LMU RAM fast access variables that have an initial value here e.g. uint32 LMU_var_init = 1; */
EndOfInitialised_LMURam_Variables
/* If you do not care where variables end up, declare them here! */
#include <math.h>
#include <string.h>
//#define M_PI 3.1415
/*** Core 0 ***/
void setup() {
// put your setup code for core 0 here, to run once:
SerialASC.begin(9600);
SerialASC.print("Test ShieldBuddyTC275 RevC (Inside setup) \n");
}
void loop() {
float y = 0.0;
// put your main code for core 0 here, to run repeatedly:
delay(1000);
y = cos(M_PI);
SerialASC.print("Test ShieldBuddyTC275 RevC (Inside loop) \n");
SerialASC.print(y,DEC);
SerialASC.print("\n");
}
/*** Core 1 ***/
/* CPU1 Uninitialised Data */
StartOfUninitialised_CPU1_Variables
/* Put your CPU1 fast access variables that have no initial values here e.g. uint32 CPU1_var; */
EndOfUninitialised_CPU1_Variables
/* CPU1 Initialised Data */
StartOfInitialised_CPU1_Variables
/* Put your CPU1 fast access variables that have an initial value here e.g. uint32 CPU1_var_init = 1; */
EndOfInitialised_CPU1_Variables
void setup1() {
// put your setup code for core 1 here, to run once:
}
void loop1() {
// put your main code for core 1 here, to run repeatedly:
}
/*** Core 2 ***/
/* CPU2 Uninitialised Data */
StartOfUninitialised_CPU2_Variables
/* Put your CPU2 fast access variables that have no initial values here e.g. uint32 CPU2_var; */
EndOfUninitialised_CPU2_Variables
/* CPU2 Initialised Data */
StartOfInitialised_CPU2_Variables
/* Put your CPU2 fast access variables that have an initial value here e.g. uint32 CPU2_var_init = 1; */
EndOfInitialised_CPU2_Variables
void setup2() {
// put your setup code for core 2 here, to run once:
}
void loop2() {
// put your main code for core 2 here, to run repeatedly:
}