Jump to content
43oh

[RESOLVED] Adding new mcu to Energia


Recommended Posts

I try to add support for a new mcu (MSP430FR2433) to Energia and would like feedback if this is the right way...

 

The boards and variants files have been already been adapted.

 

Because Energia uses GCC also I copied the msp430fr2433.h from the TI CCS directory: \ti\ccsv6\ccs_base\msp430\include_gcc\ to the Energia directory: \energia-0101E0017\hardware\tools\msp430\msp430\include\msp430fr2433.h

 

But when I try to build the basic blink example I get errors like

 

Quote

In file included from c:\energia-0101e0017\hardware\tools\msp430\bin\../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:1729:0,
                 from C:\energia-0101E0017\hardware\msp430\cores\msp430/Energia.h:4,
                 from blink.cpp:20:
c:\energia-0101e0017\hardware\tools\msp430\bin\../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430fr2433.h:150:6: error: expected constructor, destructor, or type conversion before '(' token

 

 

Looking at this line and comparing it to the already existing msp430fr4131.h I notice the difference:

fr2433.h:

sfr_w(ADCCTL0);                               /* ADC Control 0 */

fr4131.h:

#define ADCCTL0_              0x0700    /* ADC Control 0 */

sfrb(ADCCTL0_L , ADCCTL0_);

Substituting the former by the latter resolves the compiler error and generates a new one on the next line. There are hundreds of such differences between the two files so I would like to know if simply replacing one with the other will be sufficient? Or is there a better method?

Link to post
Share on other sites

Note: this post has been edited, see at the bottom.

 

So, to document the process, I've laboured through the msp430fr2433.h file and changed all the register definitions and checked their addresses with the datasheet. After that the compiler complained about

 

 

In function 'USCIA0_ISR':
C:\energia-0101E0017\hardware\msp430\cores\msp430\usci_isr_handler.c:32:6: error: interrupt vector offset 47 must be even and non-negative

 

This is the original vector table from the include_gcc directory in CCS:

/************************************************************
* Interrupt Vectors (offset from 0xFF80 + 0x10 for Password)
************************************************************/

#define PORT2_VECTOR            (42)                     /* 0xFFDA Port 2 */
#define PORT1_VECTOR            (43)                     /* 0xFFDC Port 1 */
#define ADC_VECTOR              (44)                     /* 0xFFDE ADC */
#define USCI_B0_VECTOR          (45)                     /* 0xFFE0 USCI B0 Receive/Transmit */
#define USCI_A1_VECTOR          (46)                     /* 0xFFE2 USCI A1 Receive/Transmit */
#define USCI_A0_VECTOR          (47)                     /* 0xFFE4 USCI A0 Receive/Transmit */
#define WDT_VECTOR              (48)                     /* 0xFFE6 Watchdog Timer */
#define RTC_VECTOR              (49)                     /* 0xFFE8 RTC */
#define TIMER3_A1_VECTOR        (50)                     /* 0xFFEA Timer3_A2 CC1, TA */
#define TIMER3_A0_VECTOR        (51)                     /* 0xFFEC Timer3_A2 CC0 */
#define TIMER2_A1_VECTOR        (52)                     /* 0xFFEE Timer2_A2 CC1, TA */
#define TIMER2_A0_VECTOR        (53)                     /* 0xFFF0 Timer2_A2 CC0 */
#define TIMER1_A1_VECTOR        (54)                     /* 0xFFF2 Timer1_A3 CC1-2, TA */
#define TIMER1_A0_VECTOR        (55)                     /* 0xFFF4 Timer1_A3 CC0 */
#define TIMER0_A1_VECTOR        (56)                     /* 0xFFF6 Timer0_A3 CC1-2, TA */
#define TIMER0_A0_VECTOR        (57)                     /* 0xFFE8 Timer0_A3 CC0 */
#define UNMI_VECTOR             (58)                     /* 0xFFFA User Non-maskable */
#define SYSNMI_VECTOR           (59)                     /* 0xFFFC System Non-maskable */
#define RESET_VECTOR            ("reset")                /* 0xFFFE Reset [Highest Priority] */

Looking at other header files and datasheets it seemed that the general formula for calculating the vectors is:

 

vector offset = (datasheet address of the vector) - (base offset) - (0x10 for Password).

 

So this was my initial solution for USCI_A0_VECTOR:

/************************************************************
* Interrupt Vectors (offset from 0xFF80 + 0x10 for Password)
************************************************************/

[...]
#define USCI_A0_VECTOR         (0x0054)                /* 0xFFE4 USCI A0 Receive/Transmit */
[...]

0xFFE4 - 0x10 - 0xFF80 = 0x0054

 

But this results in an compiler error that the vector address is "beyond end of MCU vector table". To resolve this I went looking for an acceptable middle road between 'non-even', 'negative' and 'beyond end' decreasing the calculated offset by 0x10 until the compiler was satisfied, which is: 0x0014. So the vector table is now defined as:

/************************************************************
* Interrupt Vectors (offset from 0xFF80 + 0x10 for Password)
************************************************************/

#define PORT2_VECTOR            (0x000A)                /* 0xFFDA Port 2 */
#define PORT1_VECTOR            (0x000C)                /* 0xFFDC Port 1 */
#define ADC_VECTOR              (0x000E)                /* 0xFFDE ADC */
#define USCI_B0_VECTOR          (0x0010)                /* 0xFFE0 USCI B0 Receive/Transmit */
#define USCI_A1_VECTOR          (0x0012)                /* 0xFFE2 USCI A1 Receive/Transmit */
#define USCI_A0_VECTOR          (0x0014)                /* 0xFFE4 USCI A0 Receive/Transmit */
#define WDT_VECTOR              (0x0016)                /* 0xFFE6 Watchdog Timer */
#define RTC_VECTOR              (0x0018)                /* 0xFFE8 RTC */
#define TIMER3_A1_VECTOR        (0x001A)                /* 0xFFEA Timer3_A2 CC1, TA */
#define TIMER3_A0_VECTOR        (0x001C)                /* 0xFFEC Timer3_A2 CC0 */
#define TIMER2_A1_VECTOR        (0x001E)                /* 0xFFEE Timer2_A2 CC1, TA */
#define TIMER2_A0_VECTOR        (0x0020)                /* 0xFFF0 Timer2_A2 CC0 */
#define TIMER1_A1_VECTOR        (0x0022)                /* 0xFFF2 Timer1_A3 CC1-2, TA */
#define TIMER1_A0_VECTOR        (0x0024)                /* 0xFFF4 Timer1_A3 CC0 */
#define TIMER0_A1_VECTOR        (0x0026)                /* 0xFFF6 Timer0_A3 CC1-2, TA */
#define TIMER0_A0_VECTOR        (0x0028)                /* 0xFFE8 Timer0_A3 CC0 */
#define UNMI_VECTOR             (0x002A)                /* 0xFFFA User Non-maskable */
#define SYSNMI_VECTOR           (0x002C)                /* 0xFFFC System Non-maskable */
#define RESET_VECTOR            (0x002E)                /* 0xFFFE Reset [Highest Priority] */

How these should be calculated instead of guessed? Beats me... And I have no clue if this table is even correct beyond compilable. Maybe someone more enlightened is willing to chime in?

 

Edit:

Uhm, no. After fixing a few other problems the compiler now complains that vector 20 is beyond the table length. It starts getting really strange: Judging by the compiler errors so far apparently the addresses need to be multiples of 2 but smaller then 20, so that gives room for only 10 interrupts. The FR2433 has 19 (or more if you count the lower 5 as well)!

 

Where is the length of the interrupt table defined? I cannot find it anywhere...

Oh duh! The length is determined by (0xFFFF - base offset) ofcourse... Let's rephrase the question: where is the base address of the interrupt table defined?

Oops, I've been editing the table so much that an error crept in. One interrupt was defined as 0x002E but should be 0x001E. Now the compiler has stopped complaining about the interrupt vector table. :) The fixed table is below:

 

 

#define PORT2_VECTOR            (0x0000)                /* 0xFFDA Port 2 */
#define PORT1_VECTOR            (0x0002)                /* 0xFFDC Port 1 */
#define ADC_VECTOR              (0x0004)                /* 0xFFDE ADC */
#define USCI_B0_VECTOR          (0x0006)                /* 0xFFE0 USCI B0 Receive/Transmit */
#define USCI_A1_VECTOR          (0x0008)                /* 0xFFE2 USCI A1 Receive/Transmit */
#define USCI_A0_VECTOR          (0x000A)                /* 0xFFE4 USCI A0 Receive/Transmit */
#define WDT_VECTOR              (0x000C)                /* 0xFFE6 Watchdog Timer */
#define RTC_VECTOR              (0x000E)                /* 0xFFE8 RTC */
#define TIMER3_A1_VECTOR        (0x0010)                /* 0xFFEA Timer3_A2 CC1, TA */
#define TIMER3_A0_VECTOR        (0x0012)                /* 0xFFEC Timer3_A2 CC0 */
#define TIMER2_A1_VECTOR        (0x0014)                /* 0xFFEE Timer2_A2 CC1, TA */
#define TIMER2_A0_VECTOR        (0x0016)                /* 0xFFF0 Timer2_A2 CC0 */
#define TIMER1_A1_VECTOR        (0x0018)                /* 0xFFF2 Timer1_A3 CC1-2, TA */
#define TIMER1_A0_VECTOR        (0x001A)                /* 0xFFF4 Timer1_A3 CC0 */
#define TIMER0_A1_VECTOR        (0x001C)                /* 0xFFF6 Timer0_A3 CC1-2, TA */
#define TIMER0_A0_VECTOR        (0x001E)                /* 0xFFE8 Timer0_A3 CC0 */
#define UNMI_VECTOR             (0x0020)                /* 0xFFFA User Non-maskable */
#define SYSNMI_VECTOR           (0x0022)                /* 0xFFFC System Non-maskable */
#define RESET_VECTOR            (0x0024)                /* 0xFFFE Reset [Highest Priority] */

 

At least the compiler gives a green light now :D

Edited by LIJsselstein
Link to post
Share on other sites

So the next problem is pleasing the linker:

 


c:/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld.exe: cannot open linker script file memory.x: No such file or directory
collect2: ld returned 1 exit status

According to some online resources I need to have the -mmcu flag correctly setup. In boards.txt is defined correctly so I was wondering... Then I discovered something new, there are also an XML-file and linker script (ldscript) directory for each mcu involved... These are added as well and building completes successfully now.

 

Next I uploaded the basic blink sketch but it didn't toggle the pin so I changed some things and tried to upload again but this time I got:

 

 

tilib: MSP430_OpenDevice: Security Fuse has been blown (error = 30)
tilib: device initialization failed

Oh deary me...

 

It seems that at least one of the many many addresses and ranges is wrong so now I need to check them all against the part- and family datasheets. :blush:

Link to post
Share on other sites

I don't think you can directly use headers from the new msp430-elf-gcc ( stuff included with CCS ) and the old open source version of msp430-gcc (stuff included with Energia). The biggest change is how they deal with the interrupt vectors. I compared the headers for the file msp430fr5969.h from the 2 compilers. Below is a just a small chunk of the changes ...

> 
4476,4501c4909,4934
< #define AES256_VECTOR           (31)                     /* 0xFFCC AES256 */
< #define RTC_VECTOR              (32)                     /* 0xFFCE RTC */
< #define PORT4_VECTOR            (33)                     /* 0xFFD0 Port 4 */
< #define PORT3_VECTOR            (34)                     /* 0xFFD2 Port 3 */
< #define TIMER3_A1_VECTOR        (35)                     /* 0xFFD4 Timer3_A2 CC1, TA */
< #define TIMER3_A0_VECTOR        (36)                     /* 0xFFD6 Timer3_A2 CC0 */
< #define PORT2_VECTOR            (37)                     /* 0xFFD8 Port 2 */
< #define TIMER2_A1_VECTOR        (38)                     /* 0xFFDA Timer2_A2 CC1, TA */
< #define TIMER2_A0_VECTOR        (39)                     /* 0xFFDC Timer2_A2 CC0 */
< #define PORT1_VECTOR            (40)                     /* 0xFFDE Port 1 */
< #define TIMER1_A1_VECTOR        (41)                     /* 0xFFE0 Timer1_A3 CC1-2, TA */
< #define TIMER1_A0_VECTOR        (42)                     /* 0xFFE2 Timer1_A3 CC0 */
< #define DMA_VECTOR              (43)                     /* 0xFFE4 DMA */
< #define USCI_A1_VECTOR          (44)                     /* 0xFFE6 USCI A1 Receive/Transmit */
< #define TIMER0_A1_VECTOR        (45)                     /* 0xFFE8 Timer0_A3 CC1-2, TA */
< #define TIMER0_A0_VECTOR        (46)                     /* 0xFFEA Timer0_A3 CC0 */
< #define ADC12_VECTOR            (47)                     /* 0xFFEC ADC */
< #define USCI_B0_VECTOR          (48)                     /* 0xFFEE USCI B0 Receive/Transmit */
< #define USCI_A0_VECTOR          (49)                     /* 0xFFF0 USCI A0 Receive/Transmit */
< #define WDT_VECTOR              (50)                     /* 0xFFF2 Watchdog Timer */
< #define TIMER0_B1_VECTOR        (51)                     /* 0xFFF4 Timer0_B7 CC1-6, TB */
< #define TIMER0_B0_VECTOR        (52)                     /* 0xFFF6 Timer0_B7 CC0 */
< #define COMP_E_VECTOR           (53)                     /* 0xFFF8 Comparator E */
< #define UNMI_VECTOR             (54)                     /* 0xFFFA User Non-maskable */
< #define SYSNMI_VECTOR           (55)                     /* 0xFFFC System Non-maskable */
< #define RESET_VECTOR            ("reset")                /* 0xFFFE Reset [Highest Priority] */
---
> #define AES256_VECTOR       (0x004C) /* 0xFFCC AES256 */
> #define RTC_VECTOR          (0x004E) /* 0xFFCE RTC */
> #define PORT4_VECTOR        (0x0050) /* 0xFFD0 Port 4 */
> #define PORT3_VECTOR        (0x0052) /* 0xFFD2 Port 3 */
> #define TIMER3_A1_VECTOR    (0x0054) /* 0xFFD4 Timer3_A2 CC1, TA */
> #define TIMER3_A0_VECTOR    (0x0056) /* 0xFFD6 Timer3_A2 CC0 */
> #define PORT2_VECTOR        (0x0058) /* 0xFFD8 Port 2 */
> #define TIMER2_A1_VECTOR    (0x005A) /* 0xFFDA Timer2_A2 CC1, TA */
> #define TIMER2_A0_VECTOR    (0x005C) /* 0xFFDC Timer2_A2 CC0 */
> #define PORT1_VECTOR        (0x005E) /* 0xFFDE Port 1 */
> #define TIMER1_A1_VECTOR    (0x0060) /* 0xFFE0 Timer1_A3 CC1-2, TA */
> #define TIMER1_A0_VECTOR    (0x0062) /* 0xFFE2 Timer1_A3 CC0 */
> #define DMA_VECTOR          (0x0064) /* 0xFFE4 DMA */
> #define USCI_A1_VECTOR      (0x0066) /* 0xFFE6 USCI A1 Receive/Transmit */
> #define TIMER0_A1_VECTOR    (0x0068) /* 0xFFE8 Timer0_A3 CC1-2, TA */
> #define TIMER0_A0_VECTOR    (0x006A) /* 0xFFEA Timer0_A3 CC0 */
> #define ADC12_VECTOR        (0x006C) /* 0xFFEC ADC */
> #define USCI_B0_VECTOR      (0x006E) /* 0xFFEE USCI B0 Receive/Transmit */
> #define USCI_A0_VECTOR      (0x0070) /* 0xFFF0 USCI A0 Receive/Transmit */
> #define WDT_VECTOR          (0x0072) /* 0xFFF2 Watchdog Timer */
> #define TIMER0_B1_VECTOR    (0x0074) /* 0xFFF4 Timer0_B7 CC1-6, TB */
> #define TIMER0_B0_VECTOR    (0x0076) /* 0xFFF6 Timer0_B7 CC0 */
> #define COMP_E_VECTOR       (0x0078) /* 0xFFF8 Comparator E */
> #define UNMI_VECTOR         (0x007A) /* 0xFFFA User Non-maskable */
> #define SYSNMI_VECTOR       (0x007C) /* 0xFFFC System Non-maskable */
> #define RESET_VECTOR        (0x007E) /* 0xFFFE Reset [Highest Priority] */
4506d4938

They use a wildly different scheme for the vector table. The new one uses an index offset from the beginning of the vector table region. The old one uses the actual offset.  Once Energia starts using the new msp430-elf-gcc compiler these problems will go away.

 

-rick 

Link to post
Share on other sites

Yes, I noticed the difference and tried to come up with a correct offset. Even while looking at a few other mcu's I couldn't find out what the correct formula is. Anyway, later I found out that there is a memory.x file for each cpu that defines the base address for the vector table.

 

E.g. for the G2553 it's:

vectors          : ORIGIN = 0xffe0, LENGTH = 0x0020 /* END=0x10000, size 32 as 16 2-byte segments */

And for the FR2433 I now have:

vectors          : ORIGIN = 0xff80, LENGTH = 0x0080 /* END=0x10000, size 128 as 64 2-byte segments */

So - when my understanding is correct - in the vector table  I should use the offset using the formula:

offset = vector address - base address

 

This is the current list:

#define PORT2_VECTOR            (0x000A)                /* 0xFFDA Port 2 */
#define PORT1_VECTOR            (0x000C)                /* 0xFFDC Port 1 */
#define ADC_VECTOR              (0x000E)                /* 0xFFDE ADC */
#define USCI_B0_VECTOR          (0x0010)                /* 0xFFE0 USCI B0 Receive/Transmit */
#define USCI_A1_VECTOR          (0x0012)                /* 0xFFE2 USCI A1 Receive/Transmit */
#define USCI_A0_VECTOR          (0x0014)                /* 0xFFE4 USCI A0 Receive/Transmit */
#define WDT_VECTOR              (0x0016)                /* 0xFFE6 Watchdog Timer */
#define RTC_VECTOR              (0x0018)                /* 0xFFE8 RTC */
#define TIMER3_A1_VECTOR        (0x001A)                /* 0xFFEA Timer3_A2 CC1, TA */
#define TIMER3_A0_VECTOR        (0x001C)                /* 0xFFEC Timer3_A2 CC0 */
#define TIMER2_A1_VECTOR        (0x001E)                /* 0xFFEE Timer2_A2 CC1, TA */
#define TIMER2_A0_VECTOR        (0x0020)                /* 0xFFF0 Timer2_A2 CC0 */
#define TIMER1_A1_VECTOR        (0x0022)                /* 0xFFF2 Timer1_A3 CC1-2, TA */
#define TIMER1_A0_VECTOR        (0x0024)                /* 0xFFF4 Timer1_A3 CC0 */
#define TIMER0_A1_VECTOR        (0x0026)                /* 0xFFF6 Timer0_A3 CC1-2, TA */
#define TIMER0_A0_VECTOR        (0x0028)                /* 0xFFE8 Timer0_A3 CC0 */
#define UNMI_VECTOR             (0x002A)                /* 0xFFFA User Non-maskable */
#define SYSNMI_VECTOR           (0x002C)                /* 0xFFFC System Non-maskable */
#define RESET_VECTOR            (0x002E)                /* 0xFFFE Reset [Highest Priority] */

The compiler is happy but I cannot confirm yet that these vectors really work.

 

I did find some errors in periph.h and the RAM length in memory.x was wrong too. But to be able to check if things work alright now I somehow need to reset the security fuse first...

Link to post
Share on other sites

msp430-objdump -CD  returns among a lot of other things:

Disassembly of section .vectors:

0000ff80 <__ivtbl_16>:
    ff80:       5e c4 5e c4     bic.b   -15266(r4),r14  ;0xc45e(r4)
    ff84:       5e c4 5e c4     bic.b   -15266(r4),r14  ;0xc45e(r4)
    ff88:       5e c4 5e c4     bic.b   -15266(r4),r14  ;0xc45e(r4)
    ff8c:       94 c5 5e c4     bic     -15266(r5),-15266(r4);0xc45e(r5), 0xc45e(r4)
    ff90:       5e c4
    ff92:       5e c4 5e c4     bic.b   -15266(r4),r14  ;0xc45e(r4)
    ff96:       5e c4 5e c4     bic.b   -15266(r4),r14  ;0xc45e(r4)
    ff9a:       5e c4 5e c4     bic.b   -15266(r4),r14  ;0xc45e(r4)
    ff9e:       00 c4           bic     r4,     r0

So, something is at 0xff80 but I have not a clue if this is good or bad...

 

The datasheet says this:

 


[iNTERRUPT FLAG]  [WORD ADDRESS]

[...]

BSL Signature 2         0FF86h
BSL Signature 1         0FF84h
JTAG Signature 2       0FF82h
JTAG Signature 1       0FF80h

Is it as simple as to conclude that the JTAG password is set to: "5e c4 5e c4"?

 

Anyway, changing the offsets of the interrupt vectors in msp430fr2433.h does not change a bit in the elf file (checked using md5 sums), changing the base address in memory.x doesn't either .... :huh:

Link to post
Share on other sites

Finally made some progress: the FR2433 definition was missing in the msp430mcu.spec file (in hardware\tools\msp430\msp430\lib\), so I copied the definitions from the fr4133 in three places.

 

Now the compiler gives the following error:

C:\energia-1.6.10E18B7\hardware\energia\msp430\cores\msp430\TimerSerial.cpp:209:26: error: 'TIMER0_A0_VECTOR' was not declared in this scope

The relevant code in TimerSerial.cpp is:

 

#ifndef TIMER0_A0_VECTOR
#define TIMER0_A0_VECTOR TIMERA0_VECTOR
#endif /* TIMER0_A0_VECTOR */

#ifndef __GNUC__
#pragma vector = TIMER0_A0_VECTOR
__interrupt
#else
__attribute__((interrupt(TIMER0_A0_VECTOR)))
#endif
//Timer0 A0 interrupt service routine
static void TimerSerial__TxIsr(void)
{
    TA0CCR0 += TICKS_PER_BIT;       // setup next time to send a bit, OUT will be set then

    TA0CCTL0 |= OUTMOD2;            // reset OUT (set to 0) OUTMOD2|OUTMOD0 (0b101)
    if ( USARTTXBUF & 0x01 ) {      // look at LSB if 1 then set OUT high
       TA0CCTL0 &= ~OUTMOD2;        // set OUT (set to 1) OUTMOD0 (0b001)
    }

    if (!(USARTTXBUF >>= 1)) {      // All bits transmitted ?
        TA0CCTL0 &= ~CCIE;          // disable interrupt, indicates we are done
    }
}
So this is specifically written to use Timer0_A0 which the FR2433 does not have... How do I handle this? Choose randomly one of the other timers and implement a new ISR in the ifndef TIMER0_A0_VECTOR section ?
Link to post
Share on other sites

Wow, what a process. Every small step forward immediately ends in another challenge. It also feels like there is unnecessary redundancy, as e.g. the capabilities of the mcu need to be defined twice (e.g. once for gcc and once for DSLite).

Not having any experience with this stuff, I would like some advice about two things:

1) In the post above I mentioned that Timer0_A0 does not exist on the FR2433, but the TimerSerial and Tone libraries assume one is available on all MCU's. I think I fixed this by extending a few defines like this in TimerSerial.cpp:
 

#ifndef TIMERA0_VECTOR
 #ifdef TIMER0_A0_VECTOR
  #define TIMERA0_VECTOR TIMER0_A0_VECTOR
 #else
  --> #define TIMERA0_VECTOR TIMER0_A3_VECTOR <--
 #endif
#endif /* TIMER0_A0_VECTOR */

It feels a bit hackish to assign the Timer0 A3 vector to Timer0 A0, is there a better way?

2) Another question I have is about DSLite: What is the difference between the different modes found in "C:\energia-1.6.10E18B7\hardware\tools\DSLite\common\targetdb\Modules\msp430"? E.g. there are three modes defined for USCI A0 UART:

- USCI_A0__UART_Mode_2.xml

- USCI_A0__UART_Mode_3.xml

- USCI_A0__UART_Mode_5.xml

And for USCI A1 UART:

- USCI_A0__UART_Mode_2.xml

- USCI_A0__UART_Mode_3.xml

 

How do I choose the correct mode for each of the three USCI's on the FR2433?

 

So, writing the firmware to the chip using Energia is not working yet, but -at least and at last- using mspflasher to write a basic blinky sketch .hex file results in a nice square waveform on the oscilloscope! Whohooo!!

Link to post
Share on other sites

Thanks Rick for taking the time.

As you probably know, Arduino/Energia produces bloated code -and that's ok-, when you compile a simple blinky sketch that only toggles a pin, it will still include lots of other code into your hex file. I.e. I2c init code is always included, as is TimerSerial and Tone apparently. Even if you don't use i2c or software serial, as in the blinky example.

 

Indeed, one of the primary reasons for choosing the fr2433 was availability of the three hardware serial peripherals, specifically the two UARTS. Though maybe software serial might come in handy for debugging or somesuch when both hardware ones are already in use.

Link to post
Share on other sites
  • 3 years later...

As a form of documenting... I just added another new MCU to Energia and -in short- had to do the following to get it working:

In Energia 1.8.7E21:

Copy from a close family member the following files and replace the model name with the new model name in the directory-/filename and file content:

  • \hardware\energia\msp430\variants\[existing-model]\
  • \hardware\tools\DSLite\common\targetdb\devices\[existing-model].xml
  • \hardware\tools\DSLite\common\targetdb\options\[existing-model]_GNU.xml
  • \hardware\tools\DSLite\common\targetdb\options\[existing-model]_TI.xml
  • \hardware\tools\msp430\msp430\lib\ldscripts\[existing-model]\
  • \hardware\tools\msp430\msp430\include\[existing-model].h

Add the new model to the following files:

  • \hardware\energia\msp430\boards.txt
  • \hardware\tools\msp430\msp430\include\msp430.h
  • \hardware\tools\msp430\msp430\lib\msp430mcu.spec

Of course, check for differences between the two family members (e.g. missing or added peripherals, memory sizes) and edit the copied files accordingly.

After the above changes it might help to remove the temporary build tree. These are located in ~/.energia15 for Linux and  %userprofile%\appdata\local\Energia15 for Windows.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...