Author Topic: error: -mmcu  (Read 14413 times)

Offline Nayani

  • Single posting newcomer
  • *
  • Posts: 4
error: -mmcu
« on: June 12, 2024, 10:17:24 am »
Hello all,
I am trying to compile code for MSP430 but getting errors. I have a folder which contains the binaries for MSP430 (in folder c:\ti\msp430-gcc). I have added the path. In CB, under settings -> compiler (heading "global compiler settings"), under compiler flags, I set (ticked) some options (optimization not set to any, I guess this will be treated as -O0), specially under MSP430 MCU derivatives (-mmcu option to CC430 5125, my controller (MSP430F67791) is not listed). When I compile a simple 'C' code without any reference controller specific instructions (just a main and a forever loop), I am getting the error "missing argument to -mmcu=". I have also set this compiler as default compiler (though I use generic GCC for Windows). Here are my questions
1. How can I rectify this error?
2. Is there a way I can provide the specific controller part which is missing in the list? If not, what is the workaround?
3. Is there any clear/elaborate tutorial on setting up embedded MCU projects and building?

I await your guidance. Thank you for your time.


Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1632
Re: error: -mmcu
« Reply #1 on: June 12, 2024, 11:10:22 am »
You should use the "GNU GCC Compiler for MSP430 (HighTec)". If your CPU is not listed, but suported by the compiler, you can add it in the "Other compiler options", p.e. -mmcu=mps430xG666

Offline Nayani

  • Single posting newcomer
  • *
  • Posts: 4
Re: error: -mmcu
« Reply #2 on: June 12, 2024, 12:41:33 pm »
Hi Miguel Gimenez,
Thank you very much for your reply. Just wanted to clarify
1. Is it necessary to use "GNU GCC Compiler for MSP430 (HighTec)" compiler only? As mentioned earlier I have msp430-gcc compiler and I included a sample header file, which gave no errors. MSP430GCC has support for my controller.
2. In case the CPU is listed, by selecting (ticking), "-mmcu=" flag should have been generated/added. Am I right? Or is it necessary that I add this under "other compiler options"?

I await your reply. Thanks once again.
Regards
NPS

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1632
Re: error: -mmcu
« Reply #3 on: June 12, 2024, 01:03:05 pm »
Using the specific compiler is the way relevant options are supported, so you do not need to add other compiler options.
Ticking the MCU will generate the "-mmcu=" flag, enable full build log and check.

Offline Nayani

  • Single posting newcomer
  • *
  • Posts: 4
Re: error: -mmcu
« Reply #4 on: June 12, 2024, 01:19:34 pm »
Thank you. I did tick (selected the controller from the available list) however the compiler complains about "mmcu" not being set. This is the issue. I will try the command line and update you.

RGDS
NPS

Offline Nayani

  • Single posting newcomer
  • *
  • Posts: 4
Re: error: -mmcu
« Reply #5 on: June 13, 2024, 11:41:07 am »
HI Miguel Gimenez,
I tried command line and the build (only compile) seems to have gone through without a hitch. Here is what I typed

msp430-elf-gcc -c -IC:\ti\msp430-gcc\include -mmcu=msp430f67791 main.c   

The main.c file content, copied from the NET

#include "msp430f67791.h"
//#include <msp430.h>            

int main(void) {
   WDTCTL = WDTPW | WDTHOLD;      // Stop watchdog timer
   P1DIR |= 0x01;               // Set P1.0 to output direction

   for(;;) {
      volatile unsigned int i;   // volatile to prevent optimization

      P1OUT ^= 0x01;            // Toggle P1.0 using exclusive-OR

      i = 10000;               // SW Delay
      do i--;
      while(i != 0);
   }
   
   return 0;
}

The issue is to configure code::blocks properly!!!! Not getting it.


Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1632
Re: error: -mmcu
« Reply #6 on: June 13, 2024, 11:49:47 am »
Follow the link I gave you in reply #3 and post a full rebuild log (use code tags, please).