Skip to main content
mattb3.14159
Associate II
October 16, 2019
Question

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

  • October 16, 2019
  • 5 replies
  • 1377 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.

5 replies

Tesla DeLorean
Guru
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.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
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);

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