Sim issues, linux & windows

From Frankenstein to Proteus and everything in between
Post Reply
tkelly2784
Posts: 5
Joined: Wed Dec 23, 2020 7:48 am

Sim issues, linux & windows

Post by tkelly2784 »

Hello, this is my first post. I'm not new to EFI or ucontrollers but I am pretty new to rusEFI. After seeing the disassembly of 5+ different factory PCM units I feel like the hardware and software of this project is future proof. Potentially to the last commercially available fossil fuel vehicle. I was always looking for that in OEM units but now here it is with open source code and hardware, great work.

Is this the right disco board?
https://estore.st.com/en/stm32f407g-disc1-cpn.html

I have a F411 board that took the firmware but didn't work as a USB device.

I was trying to use the virtual device on Linux and Windows. I have Wine setup for a video game (league) and a lot of other win apps run with it like tunerpro and a few STM tools. Running rusefi_simulator.exe started a new dos style terminal and these ports showed up

wineserve 868666 tom 22u IPv4 446418916 0t0 TCP *:29001 (LISTEN)
wineserve 868666 tom 135u IPv4 446418917 0t0 TCP *:29002 (LISTEN)

I'm not sure how to send these to a virtual serial device. I found a tutorial with socat but I could not figure out how to use it with the 29001/2 ports.


On Windows after following the tutorial in the wiki I get the error in tuner studio that the firmware on the device and the firmware in the ecu definition are mismatched.

Project Serial signature; 'rusEFI 2020.12.24.mre_f4.3958746195
MegaSquirt Serial signature:'rusEFI 2020.12.18.all.1450060126'


Can I change the firmware loaded into the sim? I thought that was the whole point to have a virtual device that you could test firmware changes and DFU systems.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Sim issues, linux & windows

Post by AndreyB »

Yes, STM32F407G-DISC1 is the perfect discovery for rusEFI. While firmware could be made to run on many stm32, we do not have human resources to support any stm32.

If you have commercial TS license if get TCP connector and serial emulator is no longer needed.

Simulator is not emulating arm or DFU, DFU and simulator are from unrelated universes. Just ignore the TS warning, as long as definition is close enough things would work. The trick is to create new project/update TS project to use latest and matching .ini file, so you make warning disappear by changing on TS side, not on simulator side.

Excited to have you around, great first questions!
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
tkelly2784
Posts: 5
Joined: Wed Dec 23, 2020 7:48 am

Re: Sim issues, linux & windows

Post by tkelly2784 »

Thanks, very helpful. I have some discos on the way. When I can get those to connect I should probably buy a license for TS to get access to all the features.

I understand now, I thought you could load compiled firmware bins into the simulator. Still nice to have if you don't want to work with a device in TS.

I was able to execute the make today and even add custom text to a serial command. I have been trying to get it to make under the ST-IDE to use the debugger. I really like the GUI for step by step debugging and code walk through. I would like to see if it boots and if the USB port works on a F411 black pill. It could be an inexpensive dev board while the discos are in the mail.

*edit* fixed the problem.
mck1117
running engine in first post
running engine in first post
Posts: 1493
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish

Re: Sim issues, linux & windows

Post by mck1117 »

tkelly2784 wrote:
Mon Dec 28, 2020 8:40 am
I understand now, I thought you could load compiled firmware bins into the simulator. Still nice to have if you don't want to work with a device in TS.
Right, the simulator is just the same logic as the firmware, but compiled as a normal x86 binary that you can run on your pc to test out the TS config and such. The simulator doesn't load the firmware, the simulator is the firmware.
tkelly2784 wrote:
Mon Dec 28, 2020 8:40 am
I was able to execute the make today and even add custom text to a serial command. I have been trying to get it to make under the ST-IDE to use the debugger. I really like the GUI for step by step debugging and code walk through.
I've found it by far the easiest to build and debug using the open source toolchain on Linux.

I should do a better write-up somewhere, but this is the rough how-to (this also fully works on Mac and might on Windows):
  1. Install the arm embedded toolchain from here: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
  2. `sudo apt-get install openocd make build-essential`
  3. Clone rusefi git repo
  4. Install vscode and extensions recommended by the repo
  5. Hit ctrl-shift-b and pick "firmware frankenso/default" or whatever it is
  6. On the debug page pick "debug f40x" and start debugging. It'll automatically flash and break in to the main() function.
tkelly2784 wrote:
Mon Dec 28, 2020 8:40 am
I would like to see if it boots and if the USB port works on a F411 black pill. It could be an inexpensive dev board while the discos are in the mail.
I'd require a bit of work as the F411 is only 100MHz, so you'd have to redefine the clock parameters to not run a hilarious overclock. It also has less memory than the f405/7, so you'd have to saw off some parts to make it fit. Not worth the hassle for a $20 f407 board :P
tkelly2784
Posts: 5
Joined: Wed Dec 23, 2020 7:48 am

Re: Sim issues, linux & windows

Post by tkelly2784 »

Thanks for the advice.

VScode can't find GIT in the path when dealing with the firmware and as a whole project it has been sitting using a few cpu cores fetching the build tasks for 3 hours now. :lol:

I got it to compile in cubeIDE last night (you have to have a fresh copy of the firmware, can not go through the git process during make for some reason it adds an unknown modifier to the compile options), and now it is debugging on the f411 board which goes directly to a fault. Probably because it thinks it is going to a F407 disco. The disco boards are in the mail, we'll see what happens when they get here.
Post Reply