This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compile Halcogen files into a separate library

Other Parts Discussed in Thread: TMS570LC4357, HALCOGEN

We are using HALCoGen to generate initialization and HAL code for a TMS570LC4357 Hercules microcontroller. The standard way to use the generated code seems to be to generate a Code Composer project around the generated code.

We would like to structure our code base in such a way that the files generated by HALCoGen are compiled into a library. This library would then be included in the build process of the main project that creates the binary image.

Our two main concerns are:

1) Do you foresee any issues with this?

2) Are there files that we should leave in the main project (e.g. the HL_sys_link.cmd)?

A few quick tests already revealed some potential issues issues when moving the HALCoGen-generated files into a separate project:

1) When the code begins running and calls _c_int00(), instead of calling the Halcogen function located in HL_sys_startup.c, the program calls _c_int00() from the c library (libc.a). This was solved by changing the order in which libraries are linked. 

2) Calling _enable_interrupt_() (located in HL_sys_core.asm) causes the program to crash. We notice the Program Counter register moves to the address 0x04 when stepping over the function. However, this does not occur when stepping instruction by instruction in the disassembly (i.e. assembly step over). This problem was solved by moving the .asm files (and not the .h files) back to the main project, where the HL_sys_link.cmd is located.

These are the type of potential issues that we are trying to find ahead of time.

Thank you.

  • We who watch this forum lack the expertise to handle your query.  Detailed knowledge of Halcogen is required here, and we don't have it.  I'll move this thread to the Hercules device forum.  But before I do, I can shed some light on one particular issue.

     

    ItKo said:
    1) When the code begins running and calls _c_int00(), instead of calling the Halcogen function located in HL_sys_startup.c, the program calls _c_int00() from the c library (libc.a). This was solved by changing the order in which libraries are linked. 

    It is apparent that the Halcogen code that you propose to put in a library defines some functions that are also present in the compiler RTS library.  The best way to handle multiple libraries with the same functions is to:

    • Make sure the linker sees all the libraries last
    • The libraries appear in the desired order
    • The option --priority is used

    Another link time check on the libraries is available with the option --scan_libraries.  This option causes the linker to issue a diagnostic whenever it finds the same function in multiple libraries.  This diagnostic tells you which library supplies that function.  

    You can read about both of those linker options in the ARM assembly language tools manual.

    Thanks and regards,

    -George

  • given this issue is being tracked/handled in another duplicate post located at this link,  

    This thread will be closed.