Hello everybody.
I am using the command line compiler chc08 and SmartLinker in order to merge an EasyCode Statecharts IDE with CodeWarrior 6.2.
EasyCode has an ability to generate a C code from the visually drawn Statecharts.
So I am trying to build the CW project by EasyCode means using the following Compiler-Linker commands:
--- Compiler:
"C:\Programme\Freescale\CodeWarrior for Microcontrollers V6.2\prog\chc08.exe" -W2 -Os -Cs08 -Ms -NoPath -I"H:\EC\HCS08_C" -I"C:\Programme\Freescale\CodeWarrior for Microcontrollers V6.2\lib\hc08c\include\" -I"C:\Programme\Freescale\CodeWarrior for Microcontrollers V6.2\lib\hc08c\device\include" -Env"OBJPATH=H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode" H:\EC\HCS08_C\Sources\main.c H:\EC\HCS08_C\Sources\Start08.c "C:\Programme\Freescale\CodeWarrior for Microcontrollers V6.2\lib\hc08c\device\src\mc9s08gb60.c" H:\EC\HCS08_C\EC_FSM.c
---Linker:
--- "C:\Programme\Freescale\CodeWarrior for Microcontrollers V6.2\prog\Linker.exe" H:\EC\HCS08_C\EC_prm\EC_HCS08_C_Target_linker.prm -WmsgSd1100 -WmsgSd1912 -Env"ABSPATH=H:\EC\HCS08_C\bin" -Env"TEXTPATH=H:\EC\HCS08_C\bin" -add(H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode\EC_FSM.o H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode\main.o H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode\Start08.o H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode\mc9s08gb60.o)
After the commands execution the linker gives me the following warnings and errors:
WARNING L1823: External object theEcFramework in H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode\main.o created by default
ERROR L1822: Symbol CEcFramework_addStatemachine in file H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode\main.o is undefined
ERROR L1822: Symbol CEcFramework_startStatemachines in file H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode\main.o is undefined
The main.c looks like that:
#include <hidef.h> /* for EnableInterrupts macro */
#include <mc9s08gb60.h> /* include peripheral declarations */
#include "./EC_FSM.h"
void main(void)
{
CUnnamed m_statemachine1;
extern CEcFramework theEcFramework;
CEcFramework_addStatemachine(&theEcFramework, &m_statemachine1 );
CEcFramework_startStatemachines(&theEcFramework);
}
The EC_FSM.h file contains the string #include "./EcFramework.h". And EcFramework.h looks like that:
#if !defined(EC_FRAMEWORK_H__INCLUDED)
#define EC_FRAMEWORK_H__INCLUDED
/////////////////////////////////////////////////////////////////////////////
#include "EcBaseStatemachine.h"
/////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
CEcBaseStatemachine* m_pFirstStatemachine; // pointer to the first added statemachine
unsigned short m_countStatemachines;
} CEcFramework;
CEcFramework* CEcFramework_Constructor( CEcFramework* pThis );
void CEcFramework_Destructor( CEcFramework* pThis );
BOOL CEcFramework_addStatemachine( CEcFramework* pThis, CEcBaseStatemachine* pStatemachine );
...
void CEcFramework_startStatemachines( CEcFramework* pThis );
...
extern unsigned char CEcFramework_countInstances;
///////////////////////////
#ifndef USE_SYSTEM_HEAP
///////////////////////////
extern EcEvent CEcFramework_eventMemory[MAX_NUMBER_ALLOCATED_EVENTS];
extern CEcEventPool CEcFramework_eventPool;
///////////////////////////
#endif // #ifndef USE_SYSTEM_HEAP
///////////////////////////
///////////////////////////
#ifdef USE_FUNCTION_ON_ASSERT
///////////////////////////
void CEcFramework_onAssert( const char* pFile, unsigned int line ); // see Customize.c in order to define this function
///////////////////////////
#endif // #ifdef USE_FUNCTION_ON_ASSERT
///////////////////////////
/////////////////////////////////////////////////////////////////////////////
// the one and only framework object:
extern CEcFramework theEcFramework;
/////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
} // extern "C"
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // !defined(EC_FRAMEWORK_H__INCLUDED)
So the functions CEcFramework_addStatemachine and CEcFramework_startStatemachines are defined in EcFramework.h which is included into EC_FSM.h.
Does anybody have an idea why the linker does not see the function-declaration?
Many thanks in advance.