cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to write an ST-Link QPSI driver for serial NOR device

willcfj
Senior

Does anyone have a decent recipe for creating the ST-Link compatible driver for an SPI NOR device? Using the examples in STM32 ST-Link utility I have been able to create and debug the needed routines to intialize, erase, write, and read my flash in a stand-alone environment created by CubeMX. It has a main() that I just used to call and debug the SPI routines. I am really struggling with how to create the driver that will work with the ST-Link utility. My MCU is an STM32H7 device and the closest example code was for an F7 device. The very limited instructions say to just plunk their example code into the Projects director of your target device, and compile!

The practice, especially with changing MCU cores is yielding layes and layers of errors that involve somewhat blindly copying over driver/include/startup files from other H7-based projects. I'm sure I could work through eventually, but seems much harder and error prone than it should be. Does anyone have a recipe for how to create these drivers with more detail than the one line "it is easy to port to other MCUs" instructions that come with the example drivers? I can't find anything in official ST documentation with any more detail, and it seems strange I can't find anything with searches here.

My preferred toolchain is Atollic (or CubeIDE), but I also have IAR available too.

Thanks in advance.

will

6 REPLIES 6

Currently doing cook to order, in a private chef capacity..

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

I appreciate the offer clive1, but don't have a budget to pay for answers unfortunately.

As with other posts of mine, hoping for community guidance and once I figure it out (either with help or by myself), plan on posting the results for all.

I'm not objecting to your business model, it's just not mine.

will

willcfj
Senior

Absent paying for a solution, I am making some progress after needing to take a break for a bit. My intent is still to write something up once I get it working.

Some important notes:

  • No success at all importing and compiling the examples I was using with the Atollic compiler. Lots of broken search paths, etc. This is the compiler I use for my apps, so was hoping to stick with the same compiler for the .stldr file.
  • I swapped over to my older free limited code size IAR compiler and YAY! I was at least able to compile the example for the L476, copy/rename it and have it show up in the list of drivers in STM32CubeProgrammer!
  • I had an older copy of the IAR IDE that doesn't support the H750, I tried manually picking the right compiler settings, but that quickly went down a rabbit hole of messiness of compiler errors.
  • I updated to the latest (still free) version of IAR that had settings for the H750, but now when I copied the .stldr file over STM32CubeProgrammer just shows an entry that is blank.
  • Figuring maybe some bad history porting from old to new compilers, I want back to the original L476 code and compiled from scratch with the new IAR. Still the same blank entry in STM32CubeProgrammer. Some online searches confirm other folk are having the same issue, but no posted resolutions yet.

So, at least making progress, but temporarily stuck between an older compiler that generates good code but doesn't support my MCU and a newer compiler that supports my MCU, but has a compatibility issue with STM32CubeProgrammer. I will continue looking at both options, not sure which one is easier to resolve. Long term, clearly would prefer to be able to use newer tools for a more general purpose solution.

I'm taking good notes so that I should have a good recipe once I get things actually working.

will

willcfj
Senior

All:

Good news! What I have isn't pretty, but I finally was able to get a working Loader file for my STM32H750! I've been documenting things as I go along, so just need t clean it up into something that makes a bit more sense.

I'm sure the process can be cleaned up a lot, but something that actually works is a good baseline from which to use as a baseline. Hopefully back in a few days.

Full disclosure: The time from my question to a solution was more a factor of me working on other stuff than the time needed to get the solution.

will

willcfj
Senior

All:

Attached is my first draft of an App note describing how I got a working Loader file for my STM32H7 along with a zipped up working project. Of note, what made this difficult was there are no source examples for the H7 series, so just "adapting an existing example" meant swapping out a lot of libraries.

Also of note, I ran into the same issue others have reported about IAR8 not generating loaders that STM32CubeProgrammer is able to parse, so this working example is based on using IAR7.

Any feedback is appreciated, and if someone is able to port it to a current IDE (one of the free ones), I'd be happy to incorporate it into the example and update the App note. Absent feedback I'll do it too, but just not as fast. The loader is a means to and end, and since I have something at least working, going to go work on the "end" a bit before coming back to updating the loader.

Hope this helps and looking forward to any feedback, would be nice to have something collaborative out of this!

will

willcfj
Senior

Hmm, seems I can have only one attachment. The ZIP file has the app note too, but here is the app note just by itself.

will