nviennot / stm32-emulator

GNU General Public License v3.0
353 stars 35 forks source link

Help wanted...? #5

Open davidbuzz opened 3 months ago

davidbuzz commented 3 months ago

would you be available to help out another open-source project to use your emulator..?

the project: https://github.com/ArduPilot/ardupilot makes software for flight-controllers, and they are nearly-all stm32 based...

I've had a bit of a go setting up a config one of our more popular boards... called a 'cubeblack', but its a stm32f427 at its core, and it also has a bootloader. here: https://github.com/davidbuzz/stm32-emulator/tree/buzz-hacking , and based on me doing a -v -v -v it seems to start running, and the program counter makes progress ,but it 'hangs' at what I think is configuring the RCC peripheral .. [clk=00131030 pc=0x081610fa] TRACE read: addr=0x40023808 peri=RCC offset=0x0008 reg=CFGR read=0x00000008

I'm also not getting to the point where I see anything out of any of the uart/s, so its early in the boot process..

maybe I've got some of the ofsets/sizes wrong in the config. or maybe u can suggest something...? ideas? Buzz. Volunteer ArduPilot hacker.

davidbuzz commented 3 months ago

I've dropped a collection a collection of reference binaries and refernece config data I used when building/compiling this into that wip branch.
this is what i did: [first get a ardupilot dev env working] ./waf configure --board=CubeBlack ./waf copter [poke around in ./build/ folder and look at output of the above commands]

davidbuzz commented 3 months ago

update, I discovered the firmware we run uses chibios for the low-level stuff, and on-boot chibios waits for a number of peripheral/s (incl rcc) to be in a particular state before it proceeds.... so I hacked out some of these in my most recent commit, rebuilt my firmware, and now the latest version boots up till it tried to configure the TIM5 peripheral... the last few lines of output from -v -v -v are... .. [clk=00137781 pc=0x08159c82] TRACE Resuming execution pc=08159c84 [clk=00307963 pc=0x08149e18] TRACE read: addr=0x50000038 peri=OTG_FS_GLOBAL offset=0x0038 reg=GCCFG read=0x00000000 [clk=00307965 pc=0x08149e1e] TRACE write: addr=0x50000038 peri=OTG_FS_GLOBAL offset=0x0038 reg=GCCFG write=0x00000000 [clk=00307996 pc=0x0816105a] TRACE read: addr=0x40000c24 peri=TIM5 offset=0x0024 reg=CNT read=0x00000000 [clk=00308028 pc=0x0816106a] TRACE write: addr=0x40000c34 peri=TIM5 offset=0x0034 reg=CCR1 write=0x000005dc [clk=00308029 pc=0x0816106c] TRACE write: addr=0x40000c10 peri=TIM5 offset=0x0010 reg=SR write=0x00000000 [clk=00308030 pc=0x0816106e] TRACE write: addr=0x40000c0c peri=TIM5 offset=0x000c reg=DIER write=0x00000002 [clk=00308035 pc=0x0816105a] TRACE read: addr=0x40000c24 peri=TIM5 offset=0x0024 reg=CNT read=0x00000000