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

Expand :bootloader target to use keyboard's hardware config #6244

Closed
1 task done
drashna opened this issue Jul 3, 2019 · 1 comment · Fixed by #6255
Closed
1 task done

Expand :bootloader target to use keyboard's hardware config #6244

drashna opened this issue Jul 3, 2019 · 1 comment · Fixed by #6255

Comments

@drashna
Copy link
Member

drashna commented Jul 3, 2019

Right now, the :bootloader target assumes the ATMega32U4, 5v controller. That's fine if you want to use that controller.

However, it would be nice if it imported the MCU, F_CPU, and other settings from the board in question. This includes the firmware size, and bootloader offset info.

The settings are here:
https://github.com/qmk/qmk_firmware/blob/master/lib/lufa/Bootloaders/DFU/makefile#L18

Feature Request Type

  • Alteration (enhancement/optimization) of existing feature(s)
@drashna
Copy link
Member Author

drashna commented Jul 4, 2019

Okay, looking into this a bit, this won't be simple. We can't just pass the data along, in memory.

Specifically, we'll have to add something like the keyboard.h genearation, but for a rules.mk or build.mk that includes all of the info that we need.

Namely:

MCU          ?= atmega32u4
ARCH         ?= AVR8
BOARD        ?= QMK
F_CPU        ?= 16000000
F_USB        ?= $(F_CPU)

FLASH_SIZE_KB         ?= 32
BOOT_SECTION_SIZE_KB  ?= 4

@jackhumbert is there an easy way to pull this information?

I know that grabbing the bootloader size should be easy enough. That's set by bootlooder.mk, actually.
But the firmware size is ... complicated.

It's:

	$(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne '/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))

Which is AVR only (and part of why ChibiOS can't check).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant