cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to create HAL library (later linked with application)?

ranran
Senior II

Hello,

We are using application with stm32, and all works well.

But we now want to divide it into: bsp HAL library and an application.

The issue is that we are not sure where the interrupt files should be inserted and the start assembly files.

Does anyone knows if it is possible to divide the big application like this , and where to put the interrupts and assemble files ?

Thanks,

ran

1 ACCEPTED SOLUTION

Accepted Solutions
ranran
Senior II
4 REPLIES 4

The heavy use of weak linkage makes creating a "ROMed" library rather problematic.

You might consider your own OS with an API and ability to load EXE/DLL like modules into it.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I just noticed now that stm32h7xx_it.c must be compiled with application in order to get interrupts, as required.

I also see that, as you said, the interrupt routines are used with "weak" attribute.

Why does it make such mess, and does copying the interrupt handlers file to application project is a suitable solution when we need to make a library ?

Thanks,

ranran
Senior II

Hi,

I've found it is possible using --whole-archive and --no-remove

see here:

https://www.iar.com/support/tech-notes/linker/hiding-symbols-from-a-library-using-isymexport-with-a-steering-file/

Thanks

The weak linkage allows for placeholding​ functions to be replaced by custom code. Obviously if you commit a specific set of functions in a given build you can't replace them with a different set later as all the associations have already been fixed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..