Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Blackpill support? #55

Open
hanetzer opened this issue Mar 31, 2022 · 8 comments
Open

Suggestion: Blackpill support? #55

hanetzer opened this issue Mar 31, 2022 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@hanetzer
Copy link

Its my understanding that the two chips are pretty close together in features and capabilities.
Would be fun to extend this to support both, if possible.

@r2axz r2axz added the enhancement New feature or request label Mar 31, 2022
@r2axz r2axz self-assigned this Mar 31, 2022
@r2axz
Copy link
Owner

r2axz commented Mar 31, 2022

Sounds like a good idea. I need to learn more about the blackpill peripherals and I guess order one, since I don't have any :)

@hanetzer
Copy link
Author

I do own a few, so if you could point out key bits I could perhaps do the code and PR it to ya

@r2axz
Copy link
Owner

r2axz commented Mar 31, 2022

That sounds even better :) Not only a great idea, but also a willingness to do the coding. Awesome! Of course I am open to answer any questions. What do you think would be the best way to start? I don't know if you've tried to get familiar with the codebase yet. Do you have any specific questions already? Or maybe we can meet on Zoom sometime and I'll try to show you the project, explain how it works, and what should be ported so that you have an idea on the scope of work.

@hanetzer
Copy link
Author

well, git grep is showing me things. btw, where does stm32f1xx.h come from?
its not in the repository.

@hanetzer
Copy link
Author

Hrm. Building it for stm32f1xx gives the following error:

mkdir -p build
arm-none-eabi-gcc -MT build/usb_descriptors.o -MMD -MP -MF build/usb_descriptors.d -DSTM32F103xB -DHSE_VALUE=8000000U -I/home/hanetzer/Firmware/stm32/STM32CubeF1/Drivers/CMSIS/Core/Include -I/home/hanetzer/Firmware/stm32/STM32CubeF1/Drivers/CMSIS/Core_A/Include -I/home/hanetzer/Firmware/stm32/STM32CubeF1/Drivers/CMSIS/Device/ST/STM32F1xx/Include -mthumb -mcpu=cortex-m3 -Wall -O3 -ggdb  -DDEVICE_VERSION_MAJOR=latest -c usb_descriptors.c -o build/usb_descriptors.o
In file included from usb_core.h:13,
                 from usb_descriptors.c:7:
<command-line>: error: ‘latest’ undeclared here (not in a function)
usb_std.h:67:44: note: in definition of macro ‘USB_BCD_VERSION’
   67 | #define USB_BCD_VERSION(maj, min, rev)  (((maj & 0xFF) << 8) | ((min & 0x0F) << 4) | (rev & 0x0F))
      |                                            ^~~
usb_descriptors.c:99:43: note: in expansion of macro ‘DEVICE_VERSION_MAJOR’
   99 |     .bcdDevice          = USB_BCD_VERSION(DEVICE_VERSION_MAJOR, DEVICE_VERSION_MINOR, DEVICE_VERSION_REVISION),
      |                                           ^~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:78: build/usb_descriptors.o] Error 1

@hanetzer
Copy link
Author

Ahh. Its a problem with the GIT_VERSION macro or the like. make GIT_VERSION=1 works (well, it builds at least)

@hanetzer
Copy link
Author

Hmm. The code could be refactored in a manner similar to https://github.com/blackmagic-debug/blackmagic and handle
the platform specifics in some subdirs.

@r2axz
Copy link
Owner

r2axz commented Apr 1, 2022

btw, where does stm32f1xx.h come from?

This comes from CMSIS, I use https://github.com/STMicroelectronics/STM32CubeF1.git, but it looks like you've figured that out already.

Hrm. Building it for stm32f1xx gives the following error:

mkdir -p build
...

That's a bug. I didn't take into account the "latest" case. Will fix that.

Hmm. The code could be refactored in a manner similar to https://github.com/blackmagic-debug/blackmagic and handle
the platform specifics in some subdirs.

Well, probably yes. Another possibility is to use ifdefs, which may be easier if we are only interested in two platforms at the moment. However, if someday we need to support more platforms in addition to black/bluepill, it'll come to this anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants