I am new NXP and am currently learning how to you use. I want use UART to send message to desktop using USB2TTL converter. I enable lpuart peripheral in code configurator and updated the code as given below. When I compile the code I get multiple definition error.
Board : S32K1446 EVAL BRD
IDE : S32 Design Studio Platform 3.5
/*!
** Copyright 2020 NXP
** @file main.c
** @brief
** Main module.
** This module contains user's application code.
*/
/*!
** @addtogroup main_module main module documentation
** @{
*/
/* MODULE main */
/* Including necessary configuration files. */
#include "sdk_project_config.h"
#include "interrupt_manager.h"
#include "clock_config.h"
#include "peripherals_lpuart_1.h"
#include "pin_mux.h"
volatile int exit_code = 0;
/* User includes */
#include <stdio.h>
#define LED0_PORT PTD
#define LED0_PIN 15
#define LED1_PORT PTD
#define LED1_PIN 16
#define LED2_PORT PTD
#define LED2_PIN 0
#define GPIO_OUT_PORT PTD
#define GPIO_OUT_PIN 18
#define SW3_PIN 13
#define SW2_PIN 12
volatile uint8_t count = 0;
void delay(volatile int cycles) {
/* Delay function - do nothing for a number of cycles */
while (cycles--)
;
}
uint32_t UART1;
void PORTC_ISR(void) {
uint32_t status = PINS_DRV_GetPortIntFlag(PORTC);
if ((status >> SW3_PIN) & 0b1) {
count++;
PINS_DRV_ClearPinIntFlagCmd(PORTC, SW3_PIN);
}
if ((status >> SW2_PIN) & 0b1) {
PINS_DRV_ClearPinIntFlagCmd(PORTC, SW2_PIN);
count++;
}
if (count >= 4) {
count = 0;
}
char uartbuf[100];
sprintf(uartbuf, "Count status : \n", count);
LPUART_DRV_SendDataBlocking(&UART1, uartbuf, strlen(uartbuf), 3000);
}
/*!
\brief The main function for the project.
\details The startup initialization sequence is the following:
* - startup asm routine
* - main()
*/
int main(void) {
/* Write your code here */
status_t error;
/* Configure clocks for PORT */
error = CLOCK_DRV_Init(&clockMan1_InitConfig0);
DEV_ASSERT(error == STATUS_SUCCESS);
/* Set pins as GPIO */
error = PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
DEV_ASSERT(error == STATUS_SUCCESS);
INT_SYS_InstallHandler(PORTC_IRQn, PORTC_ISR, (isr_t*) 0);
INT_SYS_EnableIRQ(PORTC_IRQn);
error = LPUART_DRV_Init(&UART1,&lpUartState1, &lpuart_1_InitConfig0);
DEV_ASSERT(error == STATUS_SUCCESS);
// LED_RED
// PINS_DRV_SetPins(LED_RED, 1 << LED_RED_PIN);
PINS_DRV_ClearPins(GPIO_OUT_PORT, 1 << GPIO_OUT_PIN);
while (1) {
// delay(720000);
printf("Count status : %d\n", count);
switch (count) {
case 0:
PINS_DRV_ClearPins(LED0_PORT, 1 << LED0_PIN);
PINS_DRV_ClearPins(LED1_PORT, 1 << LED1_PIN);
PINS_DRV_ClearPins(LED2_PORT, 1 << LED2_PIN);
break;
case 1:
PINS_DRV_SetPins(LED0_PORT, 1 << LED0_PIN);
PINS_DRV_ClearPins(LED1_PORT, 1 << LED1_PIN);
PINS_DRV_ClearPins(LED2_PORT, 1 << LED2_PIN);
break;
case 2:
PINS_DRV_ClearPins(LED0_PORT, 1 << LED0_PIN);
PINS_DRV_SetPins(LED1_PORT, 1 << LED1_PIN);
PINS_DRV_ClearPins(LED2_PORT, 1 << LED2_PIN);
break;
case 3:
PINS_DRV_ClearPins(LED0_PORT, 1 << LED0_PIN);
PINS_DRV_ClearPins(LED1_PORT, 1 << LED1_PIN);
PINS_DRV_SetPins(LED2_PORT, 1 << LED2_PIN);
break;
default:
break;
}
// PINS_DRV_TogglePins(GPIO_OUT_PORT, 1 << GPIO_OUT_PIN);
}
return exit_code;
}
/* END main */
/*!
** @}
*/
Error messages
make: *** [makefile:48: test.elf] Error 1
multiple definition of `CLOCK_DRV_GetFreq'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:1859: first defined here
multiple definition of `CLOCK_DRV_GetSystemClockSource'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/scg_hw_access.h:72: first defined here
multiple definition of `CLOCK_DRV_Init'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:602: first defined here
multiple definition of `CLOCK_DRV_SetClockSource'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:4014: first defined here
multiple definition of `CLOCK_DRV_SetModuleClock'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:3394: first defined here
multiple definition of `CLOCK_DRV_SetSystemClock'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:3549: first defined here
multiple definition of `CLOCK_SYS_GetCurrentConfiguration'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:4242: first defined here
multiple definition of `CLOCK_SYS_GetErrorCallback'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:4256: first defined here
multiple definition of `CLOCK_SYS_GetFreq'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:4275: first defined here
multiple definition of `CLOCK_SYS_Init'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:4092: first defined here
multiple definition of `CLOCK_SYS_SetConfiguration'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:4287: first defined here
multiple definition of `CLOCK_SYS_UpdateConfiguration'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c:4123: first defined here
multiple definition of `INT_SYS_ClearPending'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:439: first defined here
multiple definition of `INT_SYS_DisableIRQ'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:225: first defined here
multiple definition of `INT_SYS_DisableIRQGlobal'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:271: first defined here
multiple definition of `INT_SYS_EnableIRQ'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:196: first defined here
multiple definition of `INT_SYS_EnableIRQGlobal'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:248: first defined here
multiple definition of `INT_SYS_GetActive'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:513: first defined here
multiple definition of `INT_SYS_GetPending'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:491: first defined here
multiple definition of `INT_SYS_GetPriority'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:366: first defined here
multiple definition of `INT_SYS_InstallHandler'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:114: first defined here
multiple definition of `INT_SYS_SetPending'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:459: first defined here
multiple definition of `INT_SYS_SetPriority'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/interrupt/interrupt_manager.c:301: first defined here
multiple definition of `PINS_DRV_ClearPinIntFlagCmd'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:216: first defined here
multiple definition of `PINS_DRV_ClearPins'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:285: first defined here
multiple definition of `PINS_DRV_ClearPortIntFlagCmd'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:284: first defined here
multiple definition of `PINS_DRV_ConfigDigitalFilter'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:258: first defined here
multiple definition of `PINS_DRV_DisableDigitalFilter'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:245: first defined here
multiple definition of `PINS_DRV_EnableDigitalFilter'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:232: first defined here
multiple definition of `PINS_DRV_GetPinIntSel'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:200: first defined here
multiple definition of `PINS_DRV_GetPinsDirection'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:67: first defined here
multiple definition of `PINS_DRV_GetPinsOutput'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:237: first defined here
multiple definition of `PINS_DRV_GetPortInputDisable'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:149: first defined here
multiple definition of `PINS_DRV_GetPortIntFlag'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:272: first defined here
multiple definition of `PINS_DRV_Init'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.c:54: first defined here
multiple definition of `PINS_DRV_ReadPins'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:330: first defined here
multiple definition of `PINS_DRV_SetGlobalIntControl'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.c:307: first defined here
multiple definition of `PINS_DRV_SetGlobalPinControl'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.c:290: first defined here
multiple definition of `PINS_DRV_SetMuxModeSel'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.c:90: first defined here
multiple definition of `PINS_DRV_SetPinDirection'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.c:225: first defined here
multiple definition of `PINS_DRV_SetPinIntSel'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:169: first defined here
multiple definition of `PINS_DRV_SetPins'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:262: first defined here
multiple definition of `PINS_DRV_SetPinsDirection'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:110: first defined here
multiple definition of `PINS_DRV_SetPortInputDisable'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:131: first defined here
multiple definition of `PINS_DRV_SetPullSel'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.h:96: first defined here
multiple definition of `PINS_DRV_TogglePins'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:307: first defined here
multiple definition of `PINS_DRV_WritePin'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.c:471: first defined here
multiple definition of `PINS_DRV_WritePins'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_driver.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_gpio_hw_access.h:214: first defined here
multiple definition of `PINS_Init'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.c:135: first defined here
multiple definition of `PINS_SetGlobalIntControl'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.c:380: first defined here
multiple definition of `PINS_SetGlobalPinControl'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.c:351: first defined here
multiple definition of `PINS_SetMuxModeSel'; ./SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.o:/root/workspaceS32DS.3.5/test/Release_FLASH/../SDK/S32K146_SDK_4.0.1/platform/drivers/src/pins/pins_port_hw_access.c:298: first defined here
S32K146_SDK_4.0.1 folder is having a drivers folder containing the drivers for clock, interrupt and pins and a device folder having startup code and other files. The platform folder only have the drivers folders which contains the drivers for clock , interrupt, pins, edma and lpuart.
I deleted the drivers folder present in the S32K146_SDK_4.0.1 to check if that could resolve the issue. At first compile it gave me a build error but when I compiled it again without making any changes it compiled successfully. So then run the code in debug and got the error given below
No source available for "WDOG_EWM_IRQHandler() at 0x458"