Ok, so recently we discovered the kernel log had some errors which David fixed (thanks). I found this as I was trying to figure out why my ADC code was failing to open more than three devices. I figured it was related to a stack usage issue, but now I can see my stack is easily large enough.
I am using MCF52259demo, CW10.2, debug MQX4.0, and I need to have 6 ADC devices, but it will only allow two.
I have modified the demo code to run three ADC devices (which are connected on my board, but possibly not on the demo board supplied). Either way, it wont fopen the third device, it will return NULL.
Attached is my modified adc_demeo.c
Here is the ttya output:
-------------- Begin ADC example --------------
Opening ADC device ...done
Opening channel #1 ...done, prepared to start by trigger
Opening channel #2 ...done, one sequence started automatically
Opening channel #3 ...failed
The function call "result = (*dev_ptr->IO_OPEN)(file_ptr, (char _PTR_)open_type_ptr, (char _PTR_)open_mode_ptr);" is not returning MQX_OK for some reason when trying to open the third device.
Original Attachment has been moved to: adc_demo.c.zip
Solved! Go to Solution.
Ok guys, so in summary, MQX4 issues:
- Any processor that has more than 2 ADC that you wish to use, you need to change ADC_MAX_SW_CHANNELS to how ever many you are using for your BSP. This is not the case in all previous versions of MQX and does not appear in the release notes (although it seems obvious that they changed this for Kenitis, which stuffed all the other projects)
- Problems with _klog_show_stack_usage() showing invalid data, see below* (if that doesnt work, there is another thread with another solution to this problem if you search on _klog_show_stack_usage
- if you have problems with _task_abort, see below*
- if you have other strange MQX4 kernel related issues, see below*
*turn off register coloring (right click project > properties > C/C++ Build > Settings > Tool Settings TAB ColdFire Compiler > processor > register coloring (UNCHECK)
clean and build everything PSP/BSP/PROJECT
And that's the end of what was a solid week and a half of development lost.
Hi.
I have little same problem with ADC on MQX4.
My first question is: Where can i uncheck the register coloring in CW10.3? I can't find it. I took a look to: right click project > properties > C/C++ Build > Settings > Tool Settings > Compiler > processor > but it isn't there.
And this is my problem:
In my application i use: TWR-K40X256 with TWR-LCD, MQX4, eGUI3, CW10.3
When i open a one ADC device on 'adc1:', then the LCD initialisation of eGUI3 fails and returns error. LCD tchres driver uses 'adc0:' so there shouldn't be a problem.
The error comes from adc.c:
if (IO_OK != (status = _adt_hw_channel_init(fd_ptr, adt_ch[ch]))) /* this should initialize ADC timer hardware */ | |
goto error_channel_5; |
but recursively it is call:
"result = (*dev_ptr->IO_OPEN)(file_ptr, (char _PTR_)open_type_ptr, (char _PTR_)open_mode_ptr);"
The returned status and too result is in both 44550 (0xAE06).
I think it could be ADC_ERROR_BAD_PARAM.
I changed the ADC_MAX_SW_CHANNELS to 4 so there shouldn't be the problem.
The LCD and the tchres driver works when i do not open any 'channel' of 'abc1:'. I combined LCD demo with adc demo from MQX4 examples, but it too does not work and returns same error.
Hello Stefan Knotek,
register coloring is available only for ColdFire MCUs, thus not available for your MCU (Kinetis). The error you showed, it's ADC_ERROR_BAD_PARAM ((ADC_ERROR_BASE | 0x06).
Please check the code in adt_kpdb code file, where is adt_period_prescaler located.
static _mqx_int adt_period_prescaler(uint_32 period)
I believe this function returns ADC_ERROR_BAD_PARAM. I have counted 3x a return with ADC_ERROR_BAD_PARAM. Find out why does it return bad param value.
Regards,
c0170
Hello Martin Kojtal,
the error occurs on line 423 in file adt_kpdb.c:
419. | if (pdb_internal.period != 0) { |
420. | _mqx_int N; |
421. | N = adt_ch->g.period / pdb_internal.period; |
422. | if (N * pdb_internal.period != adt_ch->g.period) |
423. | return ADC_ERROR_BAD_PARAM; /* it's only allowed to have periods as multiple of basic period */ |
adt_ch->g.period = 250
pdb_internal.period = 300000
When i do not open any 'channel' of 'abc1:' (just 'adc1: is open') the LCD works and
for open X adc channel:
adt_ch->g.period = 250
pdb_internal.period = 0
for open Y adc channel:
adt_ch->g.period = 250
pdb_internal.period = 250
What does it mean?
Ok guys, so in summary, MQX4 issues:
- Any processor that has more than 2 ADC that you wish to use, you need to change ADC_MAX_SW_CHANNELS to how ever many you are using for your BSP. This is not the case in all previous versions of MQX and does not appear in the release notes (although it seems obvious that they changed this for Kenitis, which stuffed all the other projects)
- Problems with _klog_show_stack_usage() showing invalid data, see below* (if that doesnt work, there is another thread with another solution to this problem if you search on _klog_show_stack_usage
- if you have problems with _task_abort, see below*
- if you have other strange MQX4 kernel related issues, see below*
*turn off register coloring (right click project > properties > C/C++ Build > Settings > Tool Settings TAB ColdFire Compiler > processor > register coloring (UNCHECK)
clean and build everything PSP/BSP/PROJECT
And that's the end of what was a solid week and a half of development lost.
FYI, my task stacks all blew out substantially by switching off register coloring! I hope I can still fit my project...
Hello Carl Norman,
let me ask you a question before I even move on to open your code file. Have you debug the code to find out what cause the adc opening channel failure? I believe if you did it, you would have specified what had happened inside the adc open function.
Otherwise, if cause of the failure is not obvious from the example you shared, somebody else has to do it for you.
Regards.
c0170
Hi,
I am not sure exactly what you mean
This part of fopen:
file_ptr->DEV_PTR = dev_ptr;
if (dev_ptr->IO_OPEN != NULL) {
result = (*dev_ptr->IO_OPEN)(file_ptr, (char _PTR_)open_type_ptr, (char _PTR_)open_mode_ptr);
if (result != MQX_OK) {
_task_set_error(result);
_mem_free(file_ptr);
return(NULL);
} /* Endif */
} /* Endif */
Result = 0xAE07, which is clearly not MQX_OK, and the error codes dont go past 0x00.
I have updated the code with another problem _task_abort doesnt work, always returns invalid _task_id..
Oh wait, you can only add attachments on the first post??
Here it is pasted in this window
CONSOL OUTPUT:
-------------- Begin Abort Task example -------
Creating test task
Test Task Created = 10002
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Task abort returned 12
-------------- Begin ADC example --------------
Opening ADC device ...done
Opening channel #1 ...done, prepared to start by trigger
Opening channel #2 ...done, one sequence started automatically
Opening channel #3 ...failed
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
/**HEADER********************************************************************
*
* Copyright (c) 2008-2009 Freescale Semiconductor;
* All Rights Reserved
*
***************************************************************************
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************
*
* $FileName: adc_demo.c$
* $Version : 3.8.35.0$
* $Date : Sep-21-2012$
*
* Comments:
*
* This file contains the source for the ADC example program.
* Two channels are running, one is running in loop, the second one
* only once.
*
*END************************************************************************/
#include <mqx.h>
#include <bsp.h>
#if MQX_USE_LWEVENTS
#include <lwevent.h>
#endif
#if ! BSPCFG_ENABLE_IO_SUBSYSTEM
#error This application requires BSPCFG_ENABLE_IO_SUBSYSTEM defined non-zero in user_config.h. Please recompile BSP with this option.
#endif
#ifndef BSP_DEFAULT_IO_CHANNEL_DEFINED
#error This application requires BSP_DEFAULT_IO_CHANNEL to be not NULL. Please set corresponding BSPCFG_ENABLE_TTYx to non-zero in user_config.h and recompile BSP with this option.
#endif
#if defined(BSP_M51EMDEMO)
#define MY_ADC "adc1:" /* must be #1 as the inputs are wired to ADC 1 */
#define MY_TRIGGER ADC_PDB_TRIGGER
#if !BSPCFG_ENABLE_ADC1
#error This application requires BSPCFG_ENABLE_ADC1 defined non-zero in user_config.h. Please recompile BSP with this option.
#endif /* BSPCFG_ENABLE_ADCx */
#elif defined(BSP_TWRMCF51AG)
#define MY_ADC "adc:" /* must be #1 as the inputs are wired to ADC 1 */
#define MY_TRIGGER ADC_PDB_TRIGGER
#if !BSPCFG_ENABLE_ADC
#error This application requires BSPCFG_ENABLE_ADC defined non-zero in user_config.h. Please recompile BSP with this option.
#endif /* BSPCFG_ENABLE_ADCx */
#elif defined(BSP_TWR_K70F120M) || (BSP_TWR_K60N512) || defined(BSP_TWR_K40X256) || defined(BSP_TWR_K40D100M) ||\
defined(BSP_TWR_K53N512) || defined(BSP_TWR_K60F120M) || defined(BSP_TWR_K60D100M) || defined(BSP_TWR_K20D72M)
#define MY_ADC "adc1:" /* must be #1 as the inputs are wired to ADC 1 */
#define MY_TRIGGER ADC_PDB_TRIGGER
#if !BSPCFG_ENABLE_ADC1
#error This application requires BSPCFG_ENABLE_ADC1 defined non-zero in user_config.h. Please recompile BSP with this option.
#endif /* BSPCFG_ENABLE_ADCx */
#elif defined(BSP_KWIKSTIK_K40X256) || defined(BSP_TWR_K20D50M) || defined(BSP_TWR_K21D50M)
#define MY_ADC "adc0:"
#define MY_TRIGGER ADC_PDB_TRIGGER
#if !BSPCFG_ENABLE_ADC0
#error This application requires BSPCFG_ENABLE_ADC0 defined non-zero in user_config.h. Please recompile BSP with this option.
#endif /* BSPCFG_ENABLE_ADCx */
#elif defined(BSP_TWRMCF51JF) || defined(BSP_TWRMCF51QM)
#define MY_ADC "adc:"
#define MY_TRIGGER ADC_PDB_TRIGGER
#if !BSPCFG_ENABLE_ADC
#error This application requires BSPCFG_ENABLE_ADC defined non-zero in user_config.h. Please recompile BSP with this option.
#endif /* BSPCFG_ENABLE_ADCx */
#elif defined(BSP_TWRMCF51MM) || defined(BSP_TWRMCF51JE)
#define MY_ADC "adc:"
#define MY_TRIGGER ADC_PDB_TRIGGER
#if !BSPCFG_ENABLE_ADC
#error This application requires BSPCFG_ENABLE_ADC defined non-zero in user_config.h. Please recompile BSP with this option.
#endif /* BSPCFG_ENABLE_ADC */
#else /* defined BSP_xxx */
#define MY_ADC "adc:"
#define MY_TRIGGER ADC_TRIGGER_1
#if !BSPCFG_ENABLE_ADC
#error This application requires BSPCFG_ENABLE_ADC defined non-zero in user_config.h. Please recompile BSP with this option.
#endif /* BSPCFG_ENABLE_ADCx */
#endif /* defined BSP_xxx */
/* Task IDs */
#define MAIN_TASK 5
#define TEST_TASK 6
/* Function prototypes */
extern void main_task(uint_32);
extern void test_task(uint_32);
const TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
/* Task Index, Function, Stack, Priority, Name, Attributes, Param, Time Slice */
{MAIN_TASK, main_task, 2000, 8, "Main", MQX_AUTO_START_TASK, 0, 0 },
{TEST_TASK, test_task, 1000, 10, "test_task", 0, 0, 0 }, //TEST
{0}
};
/* ADC device init struct */
const ADC_INIT_STRUCT adc_init = {
ADC_RESOLUTION_DEFAULT, /* resolution */
};
#if MQX_USE_LWEVENTS
static LWEVENT_STRUCT evn1;
static LWEVENT_STRUCT evn2;
static LWEVENT_STRUCT evn3;
#endif
/* Logical channel #1 init struct */
const ADC_INIT_CHANNEL_STRUCT adc_channel_param1 =
{
ADC_SOURCE_AN5,
ADC_CHANNEL_MEASURE_LOOP | ADC_CHANNEL_START_TRIGGERED, /* runs continuously after IOCTL trigger */
10, /* number of samples in one run sequence */
0, /* time offset from trigger point in us */
300000, /* period in us (= 0.3 sec) */
0x10000, /* scale range of result (not used now) */
10, /* circular buffer size (sample count) */
1, /* logical trigger ID that starts this ADC channel */
&evn1,
0x01 /* mask of event to be set */
};
/* Logical channel #2 init struct */
const ADC_INIT_CHANNEL_STRUCT adc_channel_param2 =
{
ADC_SOURCE_AN7,
ADC_CHANNEL_MEASURE_LOOP | ADC_CHANNEL_START_TRIGGERED, /* runs continuously after IOCTL trigger */
10, /* number of samples in one run sequence */
0, /* time offset from trigger point in us */
300000, /* period in us (= 0.3 sec) */
0x10000, /* scale range of result (not used now) */
10, /* circular buffer size (sample count) */
2, /* logical trigger ID that starts this ADC channel */
&evn2,
0x01 /* mask of event to be set */
};
const ADC_INIT_CHANNEL_STRUCT adc_channel_param3 =
{
ADC_SOURCE_AN4,
ADC_CHANNEL_MEASURE_LOOP | ADC_CHANNEL_START_TRIGGERED, /* runs continuously after IOCTL trigger */
10, /* number of samples in one run sequence */
0, /* time offset from trigger point in us */
300000, /* period in us (= 0.3 sec) */
0x10000, /* scale range of result (not used now) */
10, /* circular buffer size (sample count) */
4, /* logical trigger ID that starts this ADC channel */
&evn3,
0x01 /* mask of event to be set */
};
/*TASK*-----------------------------------------------------
**
** Task Name : main_task
** Comments :
**
*END*-----------------------------------------------------*/
_task_id TEST_Task_ID = 0;
void Exit_Handler(void)
{
printf("Aborting Task\n");
}
void test_task(uint_32 x)
{
_task_set_exit_handler(TEST_Task_ID, _CODE_PTR_ Exit_Handler);
for(;;)
{
printf("Hello from test_Task\n");
_time_delay(2000);
}
}
void main_task
(
uint_32 initial_data
)
{
ADC_RESULT_STRUCT data;
uint_32 error = 0;
_mqx_int i;
MQX_FILE_PTR f, f_ch1;
MQX_FILE_PTR f_ch2;
MQX_FILE_PTR f_ch3;
printf("\n\n-------------- Begin Abort Task example -------\n\n");
printf("Creating test task\n");
TEST_Task_ID = _task_create(0, _task_get_template_index("test_task"), 0);
printf("Test Task Created = %X\n", TEST_Task_ID);
_time_delay(10000);
printf("Abort Task ID = %X\n", TEST_Task_ID);
error = _task_abort(TEST_Task_ID);
printf("Task abort returned %X", error);
printf("\n\n-------------- Begin ADC example --------------\n\n");
#if MQX_USE_LWEVENTS
if (_lwevent_create(&evn1, 0) != MQX_OK) {
printf("\nMake event failed!\n");
_task_block();
}
if (_lwevent_create(&evn2, 0) != MQX_OK) {
printf("\nMake event failed!\n");
_task_block();
}
if (_lwevent_create(&evn3, 0) != MQX_OK) {
printf("\nMake event failed!\n");
_task_block();
}
#endif
printf("Opening ADC device ...");
f = fopen(MY_ADC, (const char*)&adc_init);
if(f != NULL)
{
printf("done\n");
}
else
{
printf("failed\n");
_task_block();
}
printf("Opening channel #1 ...");
f_ch1 = fopen(MY_ADC "first", (const char*)&adc_channel_param1);
if(f_ch1 != NULL)
{
printf("done, prepared to start by trigger\n");
}
else
{
printf("failed\n");
_task_block();
}
printf("Opening channel #2 ...");
f_ch2 = fopen(MY_ADC "second", (const char*)&adc_channel_param2); /* adc:2 is running now */
if(f_ch2 != NULL)
{
printf("done, one sequence started automatically\n");
}
else
{
printf("failed\n");
_task_block();
}
printf("Opening channel #3 ...");
f_ch3 = fopen(MY_ADC "third", (const char*)&adc_channel_param3); /* adc:2 is running now */
if(f_ch3 != NULL)
{
printf("done, one sequence started automatically\n");
}
else
{
printf("failed\n");
_task_block();
}
_time_delay(1000);
printf("Triggering channel #1...");
ioctl(f, ADC_IOCTL_FIRE_TRIGGER, (pointer) ADC_TRIGGER_1);
printf("triggered!\n");
#warning ADDED CODE Here for channel 3
printf("Triggering channel #2...");
ioctl(f, ADC_IOCTL_FIRE_TRIGGER, (pointer) ADC_TRIGGER_2);
printf("triggered!\n");
printf("Triggering channel #3...");
ioctl(f, ADC_IOCTL_FIRE_TRIGGER, (pointer) ADC_TRIGGER_3);
printf("triggered!\n");
for(i = 0; ; i++)
{
/* channel 1 sample ready? */
if (read(f_ch1, &data, sizeof(data) ))
printf("ADC ch 1: %4d\n", data.result);
else
printf(" ");
/* channel 2 sample ready? */
if (read(f_ch2, &data, sizeof(data) ))
printf("ADC ch 2: %d\n", data.result);
else
printf("\n");
/* channel 3 sample ready? */
if (read(f_ch3, &data, sizeof(data) ))
printf("ADC ch 3: %d\n", data.result);
else
printf("\n");
if (i == 37) {
printf("Pausing channel #1...");
if (IO_OK == ioctl (f_ch1, ADC_IOCTL_PAUSE_CHANNEL, NULL))
printf("stopped!\n");
else
printf("failed!\n");
}
if (i == 53) {
printf("Resuming channel #1...");
if (IO_OK == ioctl (f_ch1, ADC_IOCTL_RESUME_CHANNEL, NULL))
printf("resumed!\n");
else
printf("failed!\n");
}
_time_delay(100);
}
#if MQX_USE_LWEVENTS
printf("Waiting for event...");
if (_lwevent_wait_ticks(&evn1, 0x01, TRUE, 0) != MQX_OK) {
printf("failed!\n");
}
else
printf("succeed!\n");
#endif
/* close all ADC channels */
printf("Closing channels...");
fclose(f_ch1);
fclose(f_ch2);
fclose(f);
printf("done!\n");
_task_block();
}
/* EOF */
I forgot to post the output from the debug session. The "MQX Task Summary" shows
Main task has the error code "Unknown Error 0xae07" and the test_task says Invalid Task ID (0x0012).
Here is the consol output, firstly from MQX4.0
-------------- Begin Abort Task example -------
Creating test task
Test Task Created = 10002
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Abort Task ID = 10002
Task abort returned 12
-------------- Begin ADC example --------------
Opening ADC device ...done
Opening channel #1 ...done, prepared to start by trigger
Opening channel #2 ...done, one sequence started automatically
Opening channel #3 ...failed
(orginal task keeps running if I leave it running)
Here is the same C file above with MQX3.7 running exactly the same user_config.h, and it works perfectly. There is a problem MQX4.0, this proves it. 100% works with the old version, exactly the same config and source file in MQX4.0 doesnt work.
-------------- Begin Abort Task example -------
Creating test task
Test Task Created = 10002
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Hello from test_Task
Abort Task ID = 10002
Task abort returned 0
-------------- Begin ADC example --------------
Opening ADC device ...done
Opening channel #1 ...done, prepared to start by trigger
Opening channel #2 ...done, one sequence started automatically
Opening channel #3 ...done, one sequence started automatically
Aborting Task
Triggering channel #1...triggered!
Triggering channel #2...triggered!
Triggering channel #3...triggered!
ADC ch 1: 2320
ADC ch 2: 705
ADC ch 3: 2329
ADC ch 1: 2319
ADC ch 2: 703
ADC ch 3: 2331
ADC ch 1: 2318
ADC ch 2: 704
ADC ch 3: 2332
ADC ch 1: 2317
ADC ch 2: 705
ADC ch 3: 2332
ADC ch 1: 2320
ADC ch 2: 707
ADC ch 3: 2330
Hello Carl Norman,
thank you for sharing more details. It's much quicker to find out the cause. Error code 0xAE07 is
#define ADC_ERROR_FULL (ADC_ERROR_BASE | 0x07) /* cannot open more files */
Line 191 in adc.c
if (ch == ADC_MAX_CHANNELS)
return ADC_ERROR_FULL; /* no free channel */
Define #define ADC_MAX_CHANNELS ADC_MAX_SW_CHANNELS, which equals to 2.
/* Note that these are SW channels for MQX driver, not related to the HW */
#define ADC_MAX_SW_CHANNELS (2)
This last define was 10 in 3.8.1 release. What I do not have a clue, how many channels is possible to open with ADC driver on MCF522xx. I remember kinetis is limited to 2. Seems to be 8, define ADC_HW_CHANNELS for MCF522x is set to 8 (adc_mcf522xx.h file).
Hope this helps, let me know.
Regards,
c0170
Thanks! Clearly that's a mistake with mqx4 as the 52259 has 8 channels.
Any idea why task abort is saying invalid task id in mqx4 and not in mqx3.0 to 3.7?
Hello,
it's intentionally to set to 2, that's limit for all MCU's .Each one should redefine this to own if it differs.
I have no clue why it returned MQX_INVALID_TASK_ID. You can diff those files ( task.c in kernel ) , task_abort_internal which returns that error. There are 6 returns with MQX_INVALID_TASK_ID. I don't know your user_config. Please check code inside abort function.
Regards,
c0170
Thanks, now MQX4 works as expected (just like the last 7 versions)
As for the task_id error, the debug MQX version now works for _task_about, but, the release version does not. It fails in task_abort at this line:
THIS RETURNS NULL ON RELEASE VERSIONS
td_ptr = (TD_STRUCT_PTR) _task_get_td(task_id);
...
#if MQX_CHECK_ERRORS
if ((td_ptr == NULL) || (td_ptr == SYSTEM_TD_PTR(kernel_data)))
{
_KLOGX2(KLOG_task_abort, MQX_INVALID_TASK_ID);
return (MQX_INVALID_TASK_ID);
} /* Endif */
#endif
Ok, so I decided I would debug the kernel myself...
In the release code, inside the _task_get_td(task_id) function, there is a line:
td_ptr = (TD_STRUCT_PTR)((uchar_ptr)kernel_data->TD_LIST.NEXT - FIELD_OFFSET(TD_STRUCT,TD_LIST_INFO));
This is wrong, very wrong, it sets td to FFFFFF94!!!
What do I do from here?
Hello,
glad it worked. Is register coloring enabled in the Release target? I remember I heard there was a problem with certain CW and CF compiler optimizations, just to be sure, disable and test.
Could you possibly check dissasembly, why _task_get_td returns NULL. What gets optimize out.
Regards,
c0170
Hi,
I edited the above post and added this:
In the release code, inside the _task_get_td(task_id) function, there is a line:
td_ptr = (TD_STRUCT_PTR)((uchar_ptr)kernel_data->TD_LIST.NEXT - FIELD_OFFSET(TD_STRUCT,TD_LIST_INFO));
This is wrong, very wrong, it sets td to FFFFFF94!!!
I am not sure what you mean exactly about colour or even optimisation. Debug version is little to no optimisation and release is full optimisation. So I guess this must be the problem? its stepping same code, just changing the optmisation so its easier to step.
The line above is the problem. Its not a function call, its a simple addition, but its wrong, returning FFFFFF94 from a simple subtraction is clearly incorrect.
Some more detail, I updated it to this code so I could narrow it down further:
td_ptr = (TD_STRUCT_PTR)(uchar_ptr)kernel_data->TD_LIST.NEXT;
//sets td_ptr to (0x200014E0)
td_ptr -= FIELD_OFFSET(TD_STRUCT,TD_LIST_INFO);
//sets td_ptr to 0x1FFFbe14
I am using 10.2 as 10.3 has a major bug... it can not program the MRAM on the 52259evb... we use the MRAM on a product...
Hi,
could you test the following proposal and share the aftermath here.
Leave the application as the release target but use the debug version of psp and bsp. If it works, use bsp release version (this shouldn't do any change). Then you can play with optimizations in psp (to identify which one causes code to break).
Once I get MCF5441 board, I can test this, although not right now :smileywink:
Regards,
c0170
Just would like to add there is a problem with the "Register coloring" optimization in ColdFire compiler CW 10.3. The option is turned on for MQX release build targets by default. To workaround this issue, all MQX libraries and application build projects should turn off "Register coloring" for use with CW 10.3.