One rule when you get in a mess is to not do anything in a hurry. What I am going to do is to clone the Hydra project from Github, build from that, and see where it gets me. I build for the black pill and it does not run at all.
I cloned into a separate directory (which I call "Mess") with the intent of keeping it separate from my actual working directory (which has recent work and uncommited changes). So now I have two copies of Hydra. I will leave my current work entirely alone and just try to get some historic code working again.
The copy I just cloned has the entire git history. It is a world unto itself. This means that I can now move back in time. I have done this before (doing checkouts for specific date/times) and have found that getting things back to the most recent state after such is tricky. This is why we are doing this in a separate copy I can throw away. We can see our commit history via:
git log git log --pretty=onelineThe second form is more condensed, but the first is easier to grasp. I use this to pick out a has to give to git, then:
git checkout commit-hashThis article explains a lot of this, along with what it calls "detached head status", which is what has tripped me up before and is what I am taking pains to avoid: So, I pick a commit from 2 days ago, get the hash from "git log" and then:
git checkout fa218763648cffb1a8ba05714169a53f32c70656 error: Your local changes to the following files would be overwritten by checkout: MakefileI use "git status" to discover the Makefile is the issue (and it told me that). Yes I did modify it. I do "git commit -a", then repeat the checkout command.
Now it works. It gives me a long explanatory warning about being in detached HEAD status. It even tells me:
HEAD is now at fa21876 Enable HS core for USB for F429Which is indeed what I wanted and confirms that the hash I selected from the log really was the right one.
Now to remind myself of things I have been doing, I use this command:
diff -qr . ../Hydra | grep differ Files ./event.c and ../Hydra/event.c differ Files ./gpio_411.c and ../Hydra/gpio_411.c differ Files ./hydra.h and ../Hydra/hydra.h differ Files ./init.c and ../Hydra/init.c differ Files ./led.c and ../Hydra/led.c differ Files ./main.c and ../Hydra/main.c differ Files ./Makefile and ../Hydra/Makefile differ Files ./rcc_411.c and ../Hydra/rcc_411.c differ Files ./serial.c and ../Hydra/serial.c differThe above results have been trimmed to just show me recent work that was restricted to the top level directory. I begin evaluating changes and copying the files one by one from Hydra (the directory with the latest work).
Files ./hydra.h and ../Hydra/hydra.h differ -- OK (enum) Files ./init.c and ../Hydra/init.c differ -- OK simple message Files ./main.c and ../Hydra/main.c differ -- OK - blink test Files ./event.c and ../Hydra/event.c differ -- OK - delay_ms Files ./led.c and ../Hydra/led.c differ -- OK - red/green Files ./gpio_411.c and ../Hydra/gpio_411.c differ -- OK Files ./serial.c and ../Hydra/serial.c differ -- disco baud rate Files ./Makefile and ../Hydra/Makefile differ Files ./rcc_411.c and ../Hydra/rcc_411.c differI got the two LED on the disco board blinking. This was just a matter of enabling clocks for all these GPIO in rcc_411.c I put this fix into the Hydra main directory.
The current serial.c depends on rcc_411.c to inform it properly of the pclk2 bus clock speed, this is fixed in rcc_411.c
So now, all the differences are in rcc_411.c. The Makefile has big revisions, but should be OK.
For the MCO clocks, I need to add some code from the new rcc code. I did this, and tried a few things, but it isn't working. I was going to use this to help debug the PLL code in rcc_411.c, but I worked it out without such.
Now that I have the F429 running at 168 Mhz, I need to retest the F411, which should run at 96 Mhz, then clean up rcc_411.c
Finally I can delete my clone with the detached HEAD. And I did!
Tom's Computer Info / tom@mmto.org