Merge pull request #64 from pjonsson/gcc9-support

tests: add GCC 9 support
This commit is contained in:
Niclas Finne 2022-05-25 13:25:09 +02:00 committed by GitHub
commit 1c3d09c7f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 10 deletions

View File

@ -40,7 +40,10 @@
#include "msp430setup.h"
#include <stdio.h>
#include <string.h>
#if __MSPGCC__
#if defined(__GNUC__) && (__GNUC__ >= 9)
#include <msp430.h>
#include <stdarg.h>
#elif __MSPGCC__
#include <msp430.h>
#include <legacymsp430.h>
#define eint() __eint()
@ -79,7 +82,7 @@ static int caseID = 0;
/*---------------------------------------------------------------------------*/
static int pos = 0;
static unsigned int times[10];
interrupt(TIMERB1_VECTOR) timerb1 (void)
ISR(TIMERB1, timerb1)
{
if(TBIV == 2) {
if(pos < 10) {
@ -266,7 +269,7 @@ static void testBitFields() {
/*--------------------------------------------------------------------------*/
static int flag;
interrupt(UART0TX_VECTOR) usart_tx_test0 (void)
ISR(USART0TX, usart_tx_test0)
{
printf("*IRQ: Flags:%d %d\n", IFG1, UTCTL0);
flag++;

View File

@ -37,7 +37,9 @@
*/
#include "msp430setup.h"
#if __MSPGCC__
#if defined(__GNUC__) && (__GNUC__ >= 9)
#include <msp430.h>
#elif __MSPGCC__
#include <msp430.h>
#include <msp430libc.h>
#include <legacymsp430.h>
@ -49,7 +51,6 @@
#endif /* __MSPGCC__ */
#include <stdio.h>
/*--------------------------------------------------------------------------*/
/* RS232 Interface */
/*--------------------------------------------------------------------------*/
@ -57,8 +58,7 @@
static int (* input_handler)(unsigned char) = NULL;
/*---------------------------------------------------------------------------*/
interrupt(UART1RX_VECTOR)
rs232_rx_usart1(void)
ISR(USART1RX, rs232_rx_usart1)
{
/* Check status register for receive errors. - before reading RXBUF since
it clears the error and interrupt flags */
@ -129,12 +129,24 @@ rs232_set_input(int (*f)(unsigned char))
input_handler = f;
}
/*--------------------------------------------------------------------------*/
#if defined(__GNUC__) && (__GNUC__ >= 9)
int
write(int fd, const char *buf, int len)
{
int i = 0;
for(; i < len && buf[i]; i++) {
rs232_send(buf[i]);
}
return i;
}
#else
int
putchar(int c)
{
rs232_send(c);
return c;
}
#endif
/*--------------------------------------------------------------------------*/

View File

@ -39,6 +39,15 @@
#ifndef __MSP430SETUP_H__
#define __MSP430SETUP_H__
#if defined(__GNUC__) && (__GNUC__ >= 9)
#define ISR(a,b) void __attribute__((interrupt(a ## _VECTOR))) b(void)
#define eint() __eint()
#define dint() __dint()
#elif defined(__GNUC__) && defined(__MSP430__)
/* This is the MSPGCC compiler */
#define ISR(a,b) interrupt(a ## _VECTOR) b(void)
#endif
void msp430_setup(void);
#define RS232_19200 1

View File

@ -38,7 +38,9 @@
*/
#include "msp430setup.h"
#if __MSPGCC__
#if defined(__GNUC__) && (__GNUC__ >= 9)
#include <msp430.h>
#elif __MSPGCC__
#include <msp430.h>
#include <legacymsp430.h>
#else /* __MSPGCC__ */
@ -80,7 +82,7 @@ static volatile unsigned int count = 0;
static volatile unsigned int seconds = 0;
static volatile unsigned int last_tar = 0;
interrupt(TIMERA1_VECTOR) timera1 (void)
ISR(TIMERA1, timera1)
{
if(TAIV == 2) {
eint();
@ -104,7 +106,7 @@ interrupt(TIMERA1_VECTOR) timera1 (void)
/*---------------------------------------------------------------------------*/
interrupt(TIMERA0_VECTOR) timera0 (void)
ISR(TIMERA0, timera0)
{
ticka0++;
TACCR0 += 4;