Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anybody using Keil MDK on Linux through wine?

I've been having trouble using keil MDK on ubuntu 18.04. After doing a couple of trial I am able to use uVision IDE of keil on my ubuntu os. Everything working fine but while trying to program my mcu it shows "No ST-Link Found". But as I insisted to be using linux I tried to install stm32cube Programmer hopping try to do somehting with hex file, but didn't work out. But somehow I managed st-link utility(which works on command line).

Now If I convert eclipse's elf file to bin or hex and load to my stm32f103vet though st-link utility, it works just nice! But when I flash hex file generated from keil, it shows nothing. Doesn't work. I am tired to try to program stm32 using keil MDK.

So if there is anybody who is using Keil MDK on his linux os please knock here. Please help me out!

like image 977
Naasif Avatar asked Mar 03 '23 15:03

Naasif


1 Answers

This isn't exactly an answer to your question directly per se, but it may still get you where you need to go in the end, and it's more than a comment, so I'll post it as an answer:

ST Development cross-platform tools with native Linux support:

I develop on Linux. I highly recommend you just switch to native Linux tools and drop Keil. ST has a full suite of natively-supported Linux Tools, which is one of the reasons I love ST so much (they are truly supporting Linux in everything they do):

  1. STM32CubeIDE - https://www.st.com/en/development-tools/stm32cubeide.html

  2. STM32CubeProgrammer - https://www.st.com/en/development-tools/stm32cubeprog.html <-- I love this tool, as it has a command-line version that works nicely. Ex command to write, verify, and start:

    STM32_Programmer_CLI -c port=SWD -w path/to/myhex.hex -v -s
    
  3. STM32CubeMX (built into STM32CubeIDE, so you don't need this separately necessarily unless you are using Eclipse instead of STM32CubeIDE) - https://www.st.com/en/development-tools/stm32cubemx.html

  4. Update May 2020: see my Eclipse setup instructions too: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/eclipse/Eclipse%20setup%20instructions%20on%20a%20new%20Linux%20(or%20other%20OS)%20computer.pdf. STM32CubeIDE is Eclipse-based so a lot of my configuration instructions here in my PDF should work in that too, though I haven't yet tried since I'm working on other projects now.

Other tools you may be interested in:

  1. Segger J-Link debug and programming probes: https://www.segger.com/products/debug-probes/j-link/

    • Work nicely with their free Ozone software, which can debug FreeRTOS applications too: https://www.segger.com/products/development-tools/ozone-j-link-debugger/

    • Can also be used to upload code from the command-line. Heres how to upload code in a single command using the Segger J-Link:

      JLinkExe -device STM32F777VI -if SWD -speed 12000 -AutoConnect 1 \
      -CommandFile /path/to/mycommandfile.txt
      

      Where mycommandfile.txt contains simply 4 commands:

      # reset mcu; Note to self :): You MUST do this before attempting to call 
      # `loadfile` or else it will fail; this reset command is in place of 
      # power cycling which I otherwise used to have to do all the time when 
      # using the Segger programmer!
      r 
      # flash a hex file to your chip
      loadfile /path/to/myhex.hex
      # reset no halt (ie: reset the mcu and start running your application 
      # you just loaded to it)
      rnh 
      exit
      
  2. You can use Eclipse on Linux as your IDE - buy this ebook (Mastering STM32, by Carmine Noviello) to see full setup instructions - https://leanpub.com/mastering-stm32


Another note about running Windows tools in Ubuntu: Wine rarely works well for me except on the simplest of programs. Usually what I do is install Virtual Box (no cost) inside Ubuntu, install Windows 10 inside Virtual Box (no-cost download straight from Microsoft), then install whatever Windows software I need inside Windows 10.

That being said, I still recommend you ditch Keil and use native STM32 Linux tools, but the Virtual Box trick really comes in handy when there's some piece of software that otherwise truly cannot be run and has no good substitute. Linux Ubuntu is my primary OS on all my home computers now, so I've had to use my Windows 10 virtual machine inside Virtual Box on occasion.

like image 84
Gabriel Staples Avatar answered Mar 06 '23 05:03

Gabriel Staples