This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Static library

Hi

I have a project made with a custom board with STM32F3, and I use ARM Keil and ARM Tools for development of the project. The current memory's layout is a partition for bootloader and other for firmware. Now, the project's specifications is changed and the memory layout is divided by 3 partition: a bootloader, kernel, firmware. The kernel has a relevant and critical functions which the final user cannot update, only can update the firmware partition.

I was thinking do a library which contains the kernel but this library must be in a static partition of the memory and some functions must be allocated in a specific address because the firmware has to access it. Do I need make a keil project to build and generate a lib? In the firmware keil project, how can a made an interface to access in the function's library?

Best regards

Parents
  • Hi Westermark,

    With a pointer table - just a struct or array with pointers stored at a fixed address - the app doesn't need to care about changed addresses in the middle tier. All it cares about is the pointer table and that the function pointers continues to have the same calling conventions and input/output signatures.

    I understand this struct/arry is located to an absolut address in the middle region but how is it initialized? Is correct this initialization from the middle region and how the firmware is getting the pointer table?

    //******************
    // Middle region
    //******************
    
    struct PointerTable{
      int (*foo)(void);
      void (*bar)(void);
    };
    int foo(void);
    void bar(void);
    
    int foo (void){
      // ...
    }
    
    int foo (void){
      // ...
    }
    
    // Inizialize pointer table struct at 0x80100005
    const struct PointerTable pt = {foo, bar} __at__ 0x8010005;
    
    //******************
    // App region
    //******************
    struct PointerTable{
            int (*foo)(void);
            void (*bar)(void);
    };
    
    
    struct PointerTable pt __at__ 0x8010005; // Middle region address
    pt.foo(); pt .bar();

    Thank you very much for your help

Reply
  • Hi Westermark,

    With a pointer table - just a struct or array with pointers stored at a fixed address - the app doesn't need to care about changed addresses in the middle tier. All it cares about is the pointer table and that the function pointers continues to have the same calling conventions and input/output signatures.

    I understand this struct/arry is located to an absolut address in the middle region but how is it initialized? Is correct this initialization from the middle region and how the firmware is getting the pointer table?

    //******************
    // Middle region
    //******************
    
    struct PointerTable{
      int (*foo)(void);
      void (*bar)(void);
    };
    int foo(void);
    void bar(void);
    
    int foo (void){
      // ...
    }
    
    int foo (void){
      // ...
    }
    
    // Inizialize pointer table struct at 0x80100005
    const struct PointerTable pt = {foo, bar} __at__ 0x8010005;
    
    //******************
    // App region
    //******************
    struct PointerTable{
            int (*foo)(void);
            void (*bar)(void);
    };
    
    
    struct PointerTable pt __at__ 0x8010005; // Middle region address
    pt.foo(); pt .bar();

    Thank you very much for your help

Children
No data