Linking Error L1822

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
5,825件の閲覧回数
Aibolit
Contributor I
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.
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,843件の閲覧回数
CrasyCat
Specialist III
Hello
 
This is a run time function for from the compiler.
You need to link the appropriate ANSI library file to your project.
 
ANSI library files are located in {Install}\lib\hc08c\lib.
Please refer to file \lib\hc08c\README.TXT to determine which is the appropriate ANSI library file.
 
The appropriate library file depends on the compiler options you are using in your project.
 
CrasyCat

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,843件の閲覧回数
CrasyCat
Specialist III
Hello
 
Looking at the generated message, I would say implementation for functions CEcFramework_addStatemachine & CEcFramework_startStatemachines  are missing in your application.
 
Where are those functions implemented?
 
I guess you have to add the object file or library file, which contains these implementations, to your project.
Actually you need to add the appropriate file to the -add linker option.
 
CrasyCat
0 件の賞賛
返信
1,843件の閲覧回数
Aibolit
Contributor I
Thank you very much, CrasyCat.
However, after I have added all the object files of EasyCODE framework new questions have appeared.
ERROR L1822: Symbol _CALL_STAR08 in file H:\EC\HCS08_C\C_Data\HCS08_C_Target\ObjectCode\EcBaseStatemachine.o is undefined
I could not find the declaration & implementation of _CALL_STAR08 symbol. Does anybody know where can it be?
Another question is if the Windows application can be called/started from the 9S08 microcontroller application in Debug mode?
Just because EasyCODE guys have implemented the statecharts debugger through the WinAPI application call WinExec.
 //! \author EasyCODE
 //! \version 8.0
 //! By default called via macro EC_DEBUG_INFO().
 //! Sends debug information to EasyCODE,
 //! in order to highlight the active state and/or transition.
void CEcFramework_sendDebugInfoToEasyCODE( char* pFilePath, int stateID, int transitionID, BOOL bEnd, char* pComment )
 {
  // TODO:
  // Call DebugStatechart.exe via command line.
  // Pass the debug information as arguments.
  char cmdLine[500];
  if ( bEnd )
   sprintf(cmdLine, "\"%s\" -end", PATH_OF_DEBUGSTATECHART_EXE)
;
  else
   sprintf(cmdLine, "\"%s\" \"%s\" stateID=%d transitionID=%d time=%d", PATH_OF_DEBUGSTATECHART_EXE, pFilePath, stateID, transitionID, ++CEcFramework_m_countDebugInfos)
;
    WinExec(cmdLine, SW_SHOWMINIMIZED);
 }
Many thanks in advance.
0 件の賞賛
返信
1,844件の閲覧回数
CrasyCat
Specialist III
Hello
 
This is a run time function for from the compiler.
You need to link the appropriate ANSI library file to your project.
 
ANSI library files are located in {Install}\lib\hc08c\lib.
Please refer to file \lib\hc08c\README.TXT to determine which is the appropriate ANSI library file.
 
The appropriate library file depends on the compiler options you are using in your project.
 
CrasyCat
0 件の賞賛
返信
1,843件の閲覧回数
Aibolit
Contributor I
Oh, thank you CrasyCat!
 
I thought the .lib libraries are automatically included by compiler when the appropriate options are set.
 
Does anybody know the way to call the Win application from the 9S08 microcontroller application in Debug mode?
 
Many thanks in advance.
0 件の賞賛
返信