__section("SectionForFlashOperations") Native_Profiler::~Native_Profiler()
{
    if(s_native_profiler.isOn)
    {
        s_native_profiler.isOn = FALSE;
        s_native_profiler.writtenData = TRUE;
        UINT64 returnTime = Native_Profiler_TimeInMicroseconds() - s_native_profiler.initTime;

        if(s_native_profiler.useBuffer)
        {
            *s_native_profiler.position++ = ((unsigned int)functionAddress) + 1;
            *s_native_profiler.position++ = (UINT32)(returnTime);
            if((s_native_profiler.position + 2) >= &ProfilerBufferEnd)
            {
                *s_native_profiler.position++ = NATIVE_PROFILER_END_TAG;
                Native_Profiler_Dump();
            }
        }
        else
        {
            UINT32 tempBuffer[2];
            tempBuffer[0] = ((unsigned int)functionAddress) + 1;
            tempBuffer[1] = (UINT32)(returnTime);
            Native_Profiler_WriteToCOM(tempBuffer, 8);
        }
        s_native_profiler.isOn = TRUE;
    }
}
__section(SectionForFlashOperations) Native_Profiler::Native_Profiler()
{
    if(s_native_profiler.isOn)
    {
        s_native_profiler.isOn = FALSE;
        s_native_profiler.writtenData = TRUE;
        UINT64 entryTime = Native_Profiler_TimeInMicroseconds() - s_native_profiler.initTime;
        functionAddress = __return_address();

        if(s_native_profiler.useBuffer)
        {
            *s_native_profiler.position++ = functionAddress;
            *s_native_profiler.position++ = (UINT32)(entryTime);
            if((s_native_profiler.position + 2) >= &ProfilerBufferEnd)
            {
                *s_native_profiler.position++ = NATIVE_PROFILER_END_TAG;
                Native_Profiler_Dump();
            }
        }
        else
        {
            UINT32 tempBuffer[2];
            tempBuffer[0] = functionAddress;
            tempBuffer[1] = (UINT32)(entryTime);
            Native_Profiler_WriteToCOM(tempBuffer, 8);
        }
        s_native_profiler.isOn = TRUE;
    }
}