2025-08-21 3:02 AM
I have started using the cube programmer API integrated in a program I wrote access external eeprom via flash loader.
I am able to read/write and download file to it without no major problem after I fought some API things.
What I think the cube programmer API misses is a call to mass erase external memory. I see that there is an API massErase but it is documented to erase internal flash. (It takes as parameter a name but it is not documented what it means, The param is called sFlashMemName so I really don't understand it's use)
I see there is a way to erase sectors but a single API like massEraseLoader (or massErase(FLASH_LOADER) or something like that would be cool). I know the flash loader can full erase a memory because one of the function it must provide is MassErase. It should be just a metter od exposing such API.
what I don't really like about the API design is that the readMemory function. It does memory allocation, why such design was chosen? If I am reading memory and passing a size I already know how much the buffer is big. So I should deal with it's memory and the function it's self. If readMemory allocate memory it should have an additional argument that is filled with how much effective memory it allocated. So the user know how much bytes it can read. I hope readMemory fails if it cannot read the amount of memory specified and do not let the buffer allocated.
Another thing that got me confused is on much dependency is necessary to have the API working! A lot of DLLs are required! Why I need QT stuff DLLs when I using a flash loader? Why not provide static linked dll so at least to reduce such dependency? I understand why some are necessary like the JLInkArm.dll and similar, but the others, are a little bit too much in my opinion.
Another small "issue" is why the Data_base need to be not in the current exe directory but the top of it. I found that because my loader wouldn't work. There should be some API to set the path of it too and not having such path "fixed".
Any despite this little design choses,
I like the API and was easy to integrate in my application