Error in PSP undefined reference to main

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error in PSP undefined reference to main

732 Views
oliviachristyva
Contributor III

hello guys,

I am working with MQX 4.2 . in IAR and i created a project with 3 tasks and was working fine. Then i changed the bsp for my LCD code  and then i found my code with 3 task is showing some linker error in IAR.

Error[Li005]: no definition for "main" [referenced from cmain.o(rt7M_tl.a)]

The code doesn't have a function as main. 

These are the tasks.

{DAC_TASK, DAC_Task, 1500, 8, "Dac_Task", MQX_AUTO_START_TASK, 0, 0 },
{ADC_TASK, ADC_Task, 2500, 9, "ADC_Task", 0, 0, 0 },
{ KEYPAD_TASK, Keypad_Task, 5000, 8, "Keypad_Task", 0, 0, 0 },

then i tried with the same bsp and psp in kds and found that it is giving same kind of error in PSP of that code

C:\Freescale\Freescale_MQX_4_2\mqx\build\kds\psp_frdmk64f\debug/..\..\..\..\source\psp\cortex_m\compiler\gcc_arm/comp.c:201: undefined reference to `main'

error is shown at this function

void toolchain_startup(void)
{
// initialize necessary hardware (clocks, ddr, ...)
init_hardware();
// initialize data - copy and zero sections
// static variables can be used on return
data_startup();
// register destructor calls of static objects
atexit(__libc_fini_array);
// run constructor calls of static objects
__libc_init_array();
// run main, if return go to exit
exit(main());                              // here is the error undefined reference to main.
}

does anybody have any idea about what is this error and how to solve it

please help

thanks and regards,

Olivia

0 Kudos
1 Reply

491 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Olivia

That means your main() is not there or is not reachable and your start-up file is looking for main(). It looks you are building an MQX app with a bare metal configuration.  In fact, in MQX, main is defined in bsp library (mqx_main.c).

I would suggest you take a look at the below document.

Freescale_MQX_4_2\doc\tools\iar\MQX_IAR_Getting_Started.pdf

Regards

Daniel

 

0 Kudos