|
Post by perschi on Feb 3, 2021 7:30:39 GMT
Hi, Is there a way to use classes with parameter-constructors as CPU1 and CPU2 variables or do the MACROS
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
StartOfInitialised_CPU2_Variables /* Put your CPU2 fast access variables that have an initial value here e.g. uint32 CPU1_var_init = 1; */ EndOfInitialised_CPU2_Variables
only work for variable assignments? I attached a simple sketch to demonstrate that declaration of myClassC0 works in expected way but myClassC1 doesn't.
Best Regards, Perschi
Attachments:myClassTest.ino (2.43 KB)
|
|
|
Post by Admin on Feb 3, 2021 10:28:17 GMT
There is something strange happening here in the Hightec GCC startup code. The initialisation of the class data is being done by core0 which is correct but then core1 is trying to do the same thing and overwriting the class data with 0. We will consult Hightec about this to find out why! The class data for myClassC1 is indeed in the DSPR1 RAM. Attached is a fixed startup code that resolves the issue. crt0-tc2x.c (13.5 KB) Copy this to: C:\Program Files (x86)\Arduino\hardware\aurduino\aurix\variants\tc275 and; C:\Program Files (x86)\Arduino\hardware\aurduino_Dx\aurix\variants\tc275
|
|
|
Post by perschi on Feb 4, 2021 7:30:42 GMT
Dear Admin, Thank you for the fast support! I confirm your work-around works now in the proper way.
Cheers, Perschi
|
|
|
Post by Admin on Feb 4, 2021 8:44:41 GMT
Please note that this is very much a workaround. One of the side effects will be that variables in the core 1 RAM (DSPR1) will not be initialised before getting to setup1() so you would have to explicitly do this at the start of setup1().
This issue has exposed a weakness in the C++ language as there is not really a proper way to assign the class variables to specific memory devices. A better approach might be to put the C0 and C1 classes into the LMU RAM instead. This has fast access from all cores.
/* 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; */ MyClass myClassC0("C0", 23); MyClass myClassC1("C1", 38); EndOfInitialised_LMURam_Variables
|
|