This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

"couldn't go to main" error

Other Parts Discussed in Thread: MSP430F1222, MSP430F122

Hi,

I am trying to write a simple software to blink a LED light on GPIO pin on MSP430F1222 MCU.

Compilation works fine but the linker doesn't work well.

After downloading the firmware to the chip IAR announce ""couldn't go to main" error.

Looking at the map file shows the linker "thinks" that the main function is "not needed". global variable 'i' as well.

I am using kickstart IAR version for MSP430. use no optimization for code.

I  am using default linker configuration file lnk430F1222.xcl supplied with the IAR.

I don't know what is wrong. please help.

Alon

The source code is:

#include <msp430f122.h>

// defines
// =======
#define OSCILLATOR_FREQ 5000000.0 // in Hz; must be float for calculations

// typedef
// =======
typedef unsigned char u_int_8;
typedef signed char s_int_8;
typedef unsigned int u_int_16;
typedef signed int s_int_16;
typedef unsigned long u_int_32;
typedef signed long s_int_32;
typedef unsigned long long u_int_64;
typedef signed long long s_int_64;

unsigned int i;


void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // stop watchdog
// if((CALBC1_1MHZ == 0xFF) || (CALDCO_1MHZ == 0xFF)) while(1);
// BCSCTL1 = CALBC1_1MHZ; // Set DCO
// DCOCTL = CALDCO_1MHZ;

// config pins as default
// ======================
// config unused IO port pins as outputs with '0' level
P1OUT = 0; // set '0' level
P1SEL = 0; // set pins as IO port
P1DIR = 0xFF; // set as output
P2OUT = 0; // set '0' level
P2SEL = 0; // set pins as IO port
P2DIR = 0xFF; // set as output
P3OUT = 0; // set '0' level
P3SEL = 0; // set pins as IO port
P3DIR = 0xFF; // set as output

// config A0 pin
P2DIR &= ~0x1;
P2SEL |= 0x1; // set pins as A0


while (1){
    P2OUT ^= 0x2;

    i = 50000;
    while (i > 0){
        i--;
    }
}
}

  • Do you have the runtime library enabled for the project?

    Sounds like the c startup routines aren't being referenced. A quick glance at my install shows it's DLIB in IAR under Project options -> General -> library configuration tab

**Attention** This is a public forum