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

DEFAULT_SPI_PORT appears to be undefined #1923

Open
ndim opened this issue Sep 8, 2024 · 5 comments
Open

DEFAULT_SPI_PORT appears to be undefined #1923

ndim opened this issue Sep 8, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@ndim
Copy link
Contributor

ndim commented Sep 8, 2024

The @DEFAULT_SPI_PORT@ from src/avrdude.conf.in appears not to be defined anywhere:

  • cmake builds substitute the @DEFAULT_SPI_PORT@ in avrdude.conf as the empty string.

  • automake builds keep the @DEFAULT_SPI_PORT@ in avrdude.conf as it is.

  • git grep DEFAULT_SPI_PORT shows only one match: the line in src/avrdude.conf.in.

This does not appear to be intentional.

@mcuee mcuee added the enhancement New feature or request label Sep 8, 2024
@mcuee
Copy link
Collaborator

mcuee commented Sep 8, 2024

@ndim

The default value is in the code since the following commit.

Please also refer to PR #933.

But I agree this can be a good improvement.

@mcuee
Copy link
Collaborator

mcuee commented Sep 8, 2024

I have to specify the linuxspi port since the default value does not work.

mcuee@raspberrypi400arm64:~/build/avrdude_git/tools $ ./test-avrdude -d 0 -p "-c linuxspi -P /dev/spidev0.1:/dev/gpiochip0:25 -p m328p"
Testing /usr/local/bin/avrdude 7.3-20240821 (c6d29a16)
Prepare "-c linuxspi -P /dev/spidev0.1:/dev/gpiochip0:25 -p m328p" and press 'enter' or 'space' to continue. Press any other key to skip
✅   0.182 s: fuse access: clear, set and read eesave fuse bit
✅   0.178 s: fuse access: set eesave fusebit to delete EEPROM on chip erase
✅   0.173 s: chip erase
✅   2.501 s: flash -U write/verify holes_rjmp_loops_32768B.hex
✅   2.479 s: flash -T write/verify holes_rjmp_loops_32768B.hex
✅   0.172 s: eeprom check whether programmer can flip 0s to 1s
✅   1.220 s: eeprom -U write/verify holes_pack_my_box_1024B.hex
✅   2.151 s: eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_1024B.hex
✅   1.307 s: chip erase and spot check flash is actually erased
✅   0.263 s: spot check eeprom is erased, too

@mcuee
Copy link
Collaborator

mcuee commented Sep 8, 2024

Current code: maybe it needs to specify the default reset pin number.

avrdude/src/linuxspi.c

Lines 146 to 151 in 30e19f2

static int linuxspi_open(PROGRAMMER *pgm, const char *pt) {
const char *port_error = "unknown port specification, "
"please use the format /dev/spidev:/dev/gpiochip[:resetno]\n";
char port_default[] = "/dev/spidev0.0:/dev/gpiochip0";
char *spidev, *gpiochip, *reset_pin;
char *port = mmt_strdup(pt);

@stefanrueger
Copy link
Collaborator

@ndim Well spotted. @mcuee Thanks for finding where the default is set in code.

I think we should replace the @DEFAULT_SPI_PORT@ during the make process, perhaps with the default value /dev/spidev0.0:/dev/gpiochip0 form the linuxspi.c code and refrain from setting it in the code.

@mcuee
Copy link
Collaborator

mcuee commented Nov 10, 2024

I think we should replace the @DEFAULT_SPI_PORT@ during the make process, perhaps with the default value /dev/spidev0.0:/dev/gpiochip0 form the linuxspi.c code and refrain from setting it in the code.

I agree.

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

3 participants