Skip to main content
Visitor II
October 16, 2019
Question

ST-Link custom external loader Write() function not found

  • October 16, 2019
  • 1 reply
  • 1346 views

I wrote an ST-Link custom external loader with Init(), Read(), Write(), MassErase(), and SectorErase(). When loading into ST-Link Utility, there is no Write() function found. It is in the map file, it does have a non-zero size and the name is not mangled (extern "C" int Write(...)). Any ideas why ST-Link Util cannot find this function?

    This topic has been closed for replies.

    1 reply

    Graduate II
    October 16, 2019

    Using what tools specifically?

    Check that it actually exported from the ELF object, perhaps inspect with FromELF or objcopy tools.

    As it is not called by any functions within the source it could also be subject to dead code elimination by the linker.

    Graduate II
    October 16, 2019

    #ifdef __ICCARM__        //IAR

    #define KeepInCompilation __root

    #elif __CC_ARM          //MDK-ARM

    #define KeepInCompilation __attribute__((used))

    #elif TASKING         //TrueStudio

    #define KeepInCompilation __attribute__((used))

    #endif

    /* Private function prototypes -----------------------------------------------*/

    //int Init (void); // Pre 4.2.0

    KeepInCompilation int Init (uint8_t configureMemoryMappedMode);

    KeepInCompilation int Write (uint32_t Address, uint32_t Size, uint8_t* buffer);

    KeepInCompilation int SectorErase (uint32_t EraseStartAddress ,uint32_t EraseEndAddress);

    KeepInCompilation uint64_t Verify (uint32_t MemoryAddr, uint32_t RAMBufferAddr, uint32_t Size, uint32_t missalignement);