Successfull compilation on linux with drvTemplate
This commit is contained in:
parent
ddbabdae42
commit
8104f87056
6 changed files with 47 additions and 233 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
canopennode
|
||||
*.o
|
||||
|
||||
43
example/Makefile
Normal file
43
example/Makefile
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Makefile for CANopenNode, basic compile with no CAN device.
|
||||
|
||||
|
||||
STACK_SRC = ../stack
|
||||
STACKDRV_SRC = ../stack/drvTemplate
|
||||
|
||||
|
||||
INCLUDE_DIRS = $(STACK_SRC) \
|
||||
-I$(STACKDRV_SRC) \
|
||||
-I.
|
||||
|
||||
|
||||
SOURCES = $(STACKDRV_SRC)/CO_driver.c \
|
||||
$(STACKDRV_SRC)/eeprom.c \
|
||||
$(STACK_SRC)/crc16-ccitt.c \
|
||||
$(STACK_SRC)/CO_SDO.c \
|
||||
$(STACK_SRC)/CO_Emergency.c \
|
||||
$(STACK_SRC)/CO_NMT_Heartbeat.c \
|
||||
$(STACK_SRC)/CO_SYNC.c \
|
||||
$(STACK_SRC)/CO_PDO.c \
|
||||
$(STACK_SRC)/CO_HBconsumer.c \
|
||||
$(STACK_SRC)/CO_SDOmaster.c \
|
||||
CANopen.c \
|
||||
CO_OD.c \
|
||||
main.c
|
||||
|
||||
|
||||
OBJS = ${SOURCES:%.c=%.o}
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -I$(INCLUDE_DIRS)
|
||||
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $*.o $<
|
||||
|
||||
|
||||
canopennode: $(OBJS)
|
||||
$(CC) $(CFLAGS) $(OBJS) -o canopennode
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) canopennode
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Header for application interface for CANopenNode stack.
|
||||
*
|
||||
* @file application.c
|
||||
* @ingroup application
|
||||
* @author Janez Paternoster
|
||||
* @copyright 2012 - 2013 Janez Paternoster
|
||||
*
|
||||
* This file is part of CANopenNode, an opensource CANopen Stack.
|
||||
* Project home page is <http://canopennode.sourceforge.net>.
|
||||
* For more information on CANopen see <http://www.can-cia.org/>.
|
||||
*
|
||||
* CANopenNode is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "CANopen.h"
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void programStart(void){
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void communicationReset(void){
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void programEnd(void){
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void programAsync(uint16_t timer1msDiff){
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void program1ms(void){
|
||||
|
||||
}
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
/**
|
||||
* Application interface for CANopenNode stack.
|
||||
*
|
||||
* @file application.h
|
||||
* @ingroup CO_application
|
||||
* @author Janez Paternoster
|
||||
* @copyright 2012 - 2013 Janez Paternoster
|
||||
*
|
||||
* This file is part of CANopenNode, an opensource CANopen Stack.
|
||||
* Project home page is <http://canopennode.sourceforge.net>.
|
||||
* For more information on CANopen see <http://www.can-cia.org/>.
|
||||
*
|
||||
* CANopenNode is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CO_APPLICATION_H
|
||||
#define CO_APPLICATION_H
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup CO_application Application interface
|
||||
* @ingroup CO_CANopen
|
||||
* @{
|
||||
*
|
||||
* Application interface for CANopenNode stack. Function is called
|
||||
* from file main_xxx.c (if implemented).
|
||||
*
|
||||
* ###Main program flow chart
|
||||
*
|
||||
* @code
|
||||
(Program Start)
|
||||
|
|
||||
V
|
||||
+------------------------------------+
|
||||
| programStart() |
|
||||
+------------------------------------+
|
||||
|
|
||||
|<-------------------------+
|
||||
| |
|
||||
V |
|
||||
(Initialze CANopen) |
|
||||
| |
|
||||
V |
|
||||
+------------------------------------+ |
|
||||
| communicationReset() | |
|
||||
+------------------------------------+ |
|
||||
| |
|
||||
V |
|
||||
(Enable CAN and interrupts) |
|
||||
| |
|
||||
|<----------------------+ |
|
||||
| | |
|
||||
V | |
|
||||
+------------------------------------+ | |
|
||||
| programAsync() | | |
|
||||
+------------------------------------+ | |
|
||||
| | |
|
||||
V | |
|
||||
(Process CANopen asynchronous) | |
|
||||
| | |
|
||||
+- infinite loop -------+ |
|
||||
| |
|
||||
+- reset communication ----+
|
||||
|
|
||||
V
|
||||
+------------------------------------+
|
||||
| programEnd() |
|
||||
+------------------------------------+
|
||||
|
|
||||
V
|
||||
(delete CANopen)
|
||||
|
|
||||
V
|
||||
(Program end)
|
||||
@endcode
|
||||
*
|
||||
*
|
||||
* ###Timer program flow chart
|
||||
*
|
||||
* @code
|
||||
(Timer interrupt 1 millisecond)
|
||||
|
|
||||
V
|
||||
(CANopen read RPDOs)
|
||||
|
|
||||
V
|
||||
+------------------------------------+
|
||||
| program1ms() |
|
||||
+------------------------------------+
|
||||
|
|
||||
V
|
||||
(CANopen write TPDOs)
|
||||
@endcode
|
||||
*
|
||||
*
|
||||
* ###Receive and transmit high priority interrupt flow chart
|
||||
*
|
||||
* @code
|
||||
(CAN receive event or)
|
||||
(CAN transmit buffer empty event)
|
||||
|
|
||||
V
|
||||
(Process received CAN message or)
|
||||
(copy next message to CAN transmit buffer)
|
||||
@endcode
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Called after microcontroller reset.
|
||||
*/
|
||||
void programStart(void);
|
||||
|
||||
|
||||
/**
|
||||
* Called after communication reset.
|
||||
*/
|
||||
void communicationReset(void);
|
||||
|
||||
|
||||
/**
|
||||
* Called before program end.
|
||||
*/
|
||||
void programEnd(void);
|
||||
|
||||
|
||||
/**
|
||||
* Called cyclically from main.
|
||||
*
|
||||
* @param timer1msDiff Time difference since last call
|
||||
*/
|
||||
void programAsync(uint16_t timer1msDiff);
|
||||
|
||||
|
||||
/**
|
||||
* Called cyclically from 1ms timer task.
|
||||
*/
|
||||
void program1ms(void);
|
||||
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
|
||||
#include "CANopen.h"
|
||||
#include "application.h"
|
||||
|
||||
|
||||
/* Global variables and objects */
|
||||
|
|
@ -44,10 +43,6 @@ int main (void){
|
|||
/* initialize EEPROM */
|
||||
|
||||
|
||||
/* Application interface */
|
||||
programStart();
|
||||
|
||||
|
||||
/* increase variable each startup. Variable is stored in EEPROM. */
|
||||
OD_powerOnCounter++;
|
||||
|
||||
|
|
@ -79,10 +74,6 @@ int main (void){
|
|||
/* Configure CAN transmit and receive interrupt */
|
||||
|
||||
|
||||
/* Application interface */
|
||||
communicationReset();
|
||||
|
||||
|
||||
/* start CAN and enable interrupts */
|
||||
CO_CANsetNormalMode(ADDR_CAN1);
|
||||
|
||||
|
|
@ -97,10 +88,6 @@ int main (void){
|
|||
CO_ENABLE_INTERRUPTS();
|
||||
|
||||
|
||||
/* Application interface */
|
||||
programAsync(timer1msDiff);
|
||||
|
||||
|
||||
/* CANopen process */
|
||||
reset = CO_process(CO, timer1msDiff);
|
||||
|
||||
|
|
@ -114,10 +101,6 @@ int main (void){
|
|||
CO_DISABLE_INTERRUPTS();
|
||||
|
||||
|
||||
/* Application interface */
|
||||
programEnd();
|
||||
|
||||
|
||||
/* delete objects from memory */
|
||||
CO_delete();
|
||||
|
||||
|
|
@ -139,10 +122,6 @@ void /* interrupt */ CO_TimerInterruptHandler(void){
|
|||
CO_process_RPDO(CO);
|
||||
|
||||
|
||||
/* Application interface */
|
||||
program1ms();
|
||||
|
||||
|
||||
CO_process_TPDO(CO);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
/* Include processor header file */
|
||||
#include <stddef.h> /* for 'NULL' */
|
||||
#include <stdint.h> /* for 'int8_t' to 'uint64_t' */
|
||||
#include <stdbool.h> /* for 'true', 'false' */
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue