2025-08-21 3:02 AM - edited 2025-09-05 1:09 PM
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. I guess 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 does memory allocation! Why such design was chosen? If I am reading memory and passing a size I already know the size of the buffer, so I should deal with it's memory! If readMemory allocate memory it should have an additional argument that is filled with the effective mount of memory that has been read/allocated. Than the user would know how much bytes it can read from the buffer. I hope that if readMemory fails, it do not let the buffer allocated! what happen if I call freeLibraryMemory without checking that readMemory had returned correctly? I hope I won't have a double free bug!
Another thing that got me confused is how 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 them? 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" I am facing is why the Data_base need to be not in the current exe directory but in the top one of it. There should be some API to set the path of it too and not having such path "fixed".
Anyway despite this little design choses,
I like the API and was easy to integrate in my application
2025-09-05 1:00 PM
No one has any idea?
Doing this would be pretty good :)