Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 231002

Forum Post: Compiler/LAUNCHXL-F28377S: CLAmath function crash if passing structure members as arguments.

$
0
0
Part Number: LAUNCHXL-F28377S Tool/software: TI C/C++ Compiler Hi, I am trying to use CLA to offload some math calculations away from CPU using CLAmath library. I am using compiler version ti-cgt-c2000_18.1.3.LTS. I have defined a global structure in a header file task1.h. This structure is then declared in task1.c file on CPU side. CLA uses the same header file and is able to access the structure. Problem is that microcontroller will not start or it goes to reset loop if I try pass the members of that structure to CLAmath functions. CLAmath functions work okay if I use any global or local non-struct variables as arguments instead. For example, task1.h: typedef struct cla_task1_variables_s { float x; float y; float Angle; } CLA_Task1Variables; task1.c #include "task1.h" #pragma SET_DATA_SECTION( "CLADataMemory" ) CLA_Task1Variables T1; float fTempGlobal; #pragma SET_DATA_SECTION() void task1_init() { //possible initialisations } task1.cla: #include "task1.h" extern CLA_Task1Variables T1; extern float fTempGlobal; float fTempLocal; void task1() { T1.x = read_value_from_ADC(0); T1.y = read_value_from_ADC(1); //Raw angle, atan2(y,x) T1.Angle = CLAatan2PU( 1.0f, 2.0f ); //[-0.5 0.5] WORKS FINE. T1.Angle = CLAatan2PU( 1.0f, fTempGlobal ); //[-0.5 0.5] WORKS FINE. T1.Angle = CLAatan2PU( 1.0f, fTempLocal ); //[-0.5 0.5] WORKS FINE. T1.Angle = CLAatan2PU( 1.0f, T1.x ); //[-0.5 0.5] WORKS FINE. T1.Angle = CLAatan2PU( T1.y, 2.0f ); //[-0.5 0.5] WORKS FINE. T1.Angle = CLAatan2PU( T1.y, T1.x ); //[-0.5 0.5] THIS WILL CAUSE WATCHDOG RESET or COMPLETE HANG or THAT CPU WILL NOT EVEN START! Why? } Any help is appreciated. JM

Viewing all articles
Browse latest Browse all 231002

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>