Tool/software: TI-RTOS
I am working on TIRTOS platform using TM4c123GH6PM.. I want to create LED Toggling using C++ using concept of Classes and Objects . Below is my code where I have used one idle function and tried to toggle LED. My code is on .cpp extension. Empty.c file I have excluded from build because it was not supporting classes and object..
#include <xdc/std.h> //mandatory - have to include first, for BIOS types #include <ti/sysbios/BIOS.h> //mandatory - if you call APIs like BIOS_start() #include <xdc/runtime/Log.h> //needed for any Log_info() call #include <xdc/cfg/global.h>//header file for statically defined objects/handles #include <stdint.h> #include <stdbool.h> #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "inc/hw_ints.h" #include "driverlib/interrupt.h" #include "driverlib/timer.h" #include <time.h> void hardware_init(void); void ledToggle1(void); void main(void) { hardware_init(); // init hardware via Xware BIOS_start(); // Start BIOS Scheduler (never returns) class LED_Status { public: int ON; int OFF; }; LED_Status status; status.ON=8; status.OFF=0; } void hardware_init(void) { //Set CPU Clock to 40MHz. 400MHz PLL/2 = 200 DIV 5 = 40MHz SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); // ADD Tiva-C GPIO setup - enables port, sets pins 1-3 (RGB) pins for output SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); } void ledToggle1(void) { GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, status.ON); // LED ON SysCtlDelay(2000000); // DELAY GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, status.OFF); // LED OFF SysCtlDelay(2000000); }
I am getting the following errors when I compile .cpp file.
Description Resource Path Location Type
#10010 errors encountered during linking; "rtos1.out" not built rtos1 C/C++ Problem
<a href="file:/c:/ti/ccsv6/tools/compiler/dmed/HTML/10234.html">#10234-D</a> unresolved symbols remain rtos1 C/C++ Problem
unresolved symbol ledToggle1, first referenced in E:\dg\rtos1\Debug\configPkg\package\cfg\empty_pem4f.oem4f rtos1 C/C++ Problem
unresolved symbol main, first referenced in C:\ti\ccsv6\tools\compiler\ti-cgt-arm_5.2.5\lib\rtsv7M4_T_le_v4SPD16_eabi.lib<args_main.obj> rtos1 C/C++ Problem
How could this problem be solved. I have to use C++ concepts like Classes and Objects.
This code runs fine on NON RTOS .cpp files but its not working here