We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When including and implementing a vector from the STL located at C:\Keil\ARM\ARMCC\include\ the following error occurs when compiling a debug function. What is the link between using a vector and the printf in the debug function? Test is the class DebugSamples is located in. Removing the vector implementation removes the error
*** error 47, line 22: sizeof returns zero
source code
static vector<float> testVector; void Test_C::Init(void) { testVector.push_back(1.0f); } void Test_C::DebugLog(void) { DebugSamples[0][sampleCount] = amples[0]; DebugSamples[1][sampleCount] = Samples[1]; DebugSamples[2][sampleCount] = samples[2]; DebugSamples[3][sampleCount] = samples[3]; DebugSamples[4][sampleCount] = samples[4]; DebugSamples[5][sampleCount] = sampleCount; sampleCount++; sampleCount %= DEBUG_SAMPLE_LIMIT; }
debug function
FUNC void log_debug_samples( void ) { int num_samples_idx; // The >> concatenates to the file and > will create a new file. // No data will be logged if > is used and the file already exists. // The directory must already exist, also. exec("log >> c:/uvdata/mhsmpls.log"); printf( "\n\ndebug Samples" ); for ( num_samples_idx = 0; num_samples_idx < 1000; num_samples_idx++ ) { // This prints the values from a private element of a global scope C++ object. printf( "\n%f\t%f\t%f\t%f\t%f\t%f", Test.DebugSamples[ 0 ][ num_samples_idx ], Test.DebugSamples[ 1 ][ num_samples_idx ], Test.DebugSamples[ 2 ][ num_samples_idx ], Test.DebugSamples[ 3 ][ num_samples_idx ], Test.DebugSamples[ 4 ][ num_samples_idx ], Test.DebugSamples[ 5 ][ num_samples_idx ] ); } exec("log off"); }
1.) I do not know what sizeof is referencing, but there is none in the code 2.) The code is an example that takes samples and puts it into a larger debug array that can be streamed out once a break point has been hit. 3.)The first code example is a debug function that is executed by the debugger using debug menu -> Function Editor to compile. The second is the code executed on the target to get the data into the debug array
I am executing on an Infineon XMC4504-512 target. Any ARM core that has vectors implemented should have the same issue with using the functionality of executing debug scripts in uVision to get variable data out of a target.