referencia no definida a 'ROM_SysTickIntRegister'

1

Estoy intentando programar el Stellaris LaunchPad para que parpadee el LED rojo a 1 Hz, impulsado por la interrupción de sysTick. Sin embargo, recibí un error que no he podido resolver.

La fuente C que se me ocurrió tiene este aspecto:

#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"

#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"

#include <stdint.h>

#define LED_RED GPIO_PIN_1

uint8_t ledState = LED_RED;

void isr( void ) {
    ledState ^= ledState; // toggle LED state
    ROM_GPIOPinWrite( GPIO_PORTF_BASE , LED_RED , ledState );
}


int main() {
    // Set system clock to 80 MHz using PLL and external 16 MHz crystal.
    ROM_SysCtlClockSet( SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN );

    // Enable GPIO for LED.
    ROM_SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOF );
    ROM_GPIOPinTypeGPIOOutput( GPIO_PORTF_BASE , LED_RED );

    // Enable SysTick at 500 ms and register an interrupt service routine.
    ROM_SysTickIntRegister( isr );
    ROM_SysTickPeriodSet( 40000000 ); // 80 MHz ÷ 2 
    HWREG( NVIC_ST_CURRENT ) = 0;     // A write to this register reloads the SysTick counter
    ROM_SysTickEnable();
    ROM_SysTickIntEnable(); // <=

    while ( 1 ) {}
}

Y estos son los comandos que utilizo para compilarlo:

arm-none-eabi-gcc \
        blink.c \
        startup_gcc.c \
        -g \
        -mthumb \
        -mcpu=cortex-m4 \
        -mfpu=fpv4-sp-d16 \
        -mfloat-abi=softfp \
        -Os \
        -ffunction-sections \
        -fdata-sections \
        -MD \
        -std=c99 \
        -Wall \
        -pedantic \
        -DPART_LM4F120H5QR \
        -c \
        -I~/stellaris/stellarisware \
        -DTARGET_IS_BLIZZARD_RA1

blink.c: In function 'main':
blink.c:34:2: warning: implicit declaration of function 'ROM_SysTickIntRegister' [-Wimplicit-function-declaration]
  ROM_SysTickIntRegister( isr );
  ^

y para enlazar:

arm-none-eabi-ld \
         -T blink.ld \
         --entry ResetISR \
         -o a.out \
         startup_gcc.o \
         blink.o \
         --gc-sections

blink.o: In function 'main':
~/stellaris/projects/sysTickBlink/blink.c:34: undefined reference to 'ROM_SysTickIntRegister'

El startup_gcc.c se puede encontrar en GitHub: enlace

  1. ¿Cómo puedo resolver la advertencia y el mensaje de error?
  2. ¿Por qué tengo que incluir inc/hw_nvic.h y inc/hw_types.h cuando también se incluye en startup_gcc.c?
  3. ¿Por qué se usa ese ResetISR durante el enlace? Lo copié del Makefile en StellarisWare.
pregunta jippie

1 respuesta

2

El systick.h en la instalación de mi launchpad no tiene funciones ROM_* . Tiene estos:

extern void SysTickEnable(void);
extern void SysTickDisable(void);
extern void SysTickIntRegister(void (*pfnHandler)(void));
extern void SysTickIntUnregister(void);
extern void SysTickIntEnable(void);
extern void SysTickIntDisable(void);
extern void SysTickPeriodSet(uint32_t ui32Period);
extern uint32_t SysTickPeriodGet(void);
extern uint32_t SysTickValueGet(void);

Soltar el ROM_

Su primer puerto de llamada debe buscar en el archivo de encabezado necesario para ver qué funciones debe usar.

También debe asegurarse de vincular los archivos c correctos desde la lista de controladores, en este caso el archivo systick.c.

    
respondido por el Majenko

Lea otras preguntas en las etiquetas