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

Not sure but I think I'm making progress #98

Open
NBAPJ opened this issue Nov 9, 2020 · 21 comments
Open

Not sure but I think I'm making progress #98

NBAPJ opened this issue Nov 9, 2020 · 21 comments

Comments

@NBAPJ
Copy link

NBAPJ commented Nov 9, 2020

I think I'm making a little progress with the bootloader I'm getting this error now

$ make bootloader
Building UF2 bootloader...
C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe -C bootloader BOARD=odiin all
make[1]: Entering directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
LD odiin_bootloader-0.3.2-158-g23e6539-dirty.out
text data bss dec hex filename
31304 1572 22594 55470 d8ae _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty.out
Create odiin_bootloader-0.3.2-158-g23e6539-dirty.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Converting to uf2, output size: 72704, start address: 0x0
Wrote 72704 bytes to _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Create odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.hex
Traceback (most recent call last):
File "C:\Program Files\Python39\Scripts\adafruit-nrfutil-script.py", line 33, in
sys.exit(load_entry_point('adafruit-nrfutil==0.5.3.post13', 'console_scripts', 'adafruit-nrfutil')())
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 829, in call
return self.main(*args, **kwargs)
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1259, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1259, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\nordicsemi_main
.py", line 237, in genpkg
package.generate_package(zipfile_path)
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\nordicsemi\dfu\package.py", line 173, in generate_package
nrf_hex.tobinfile(sd_bl_file_path)
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\nordicsemi\dfu\nrfhex.py", line 162, in tobinfile
super(nRFHex, self).tobinfile(fobj, start=start_address, size=size)
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\nordicsemi\dfu\intelhex_init
.py", line 401, in tobinfile
binstr = self.tobinstr_really(start, end, pad, size)
File "C:\Users\melenese\AppData\Roaming\Python\Python39\site-packages\nordicsemi\dfu\intelhex_init
.py", line 373, in _tobinstr_really
return asstr(self._tobinarray_really(start, end, pad, size).tostring())
AttributeError: 'array.array' object has no attribute 'tostring'
make[1]: *** [Makefile:401: _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.zip] Error 1
make[1]: Leaving directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
make: *** [Makefile:483: bootloader] Error 2

This was referenced Nov 10, 2020
@nitz
Copy link
Collaborator

nitz commented Nov 10, 2020

Hey I closed some of the other issues you had opened, let's try to keep it in this one til we get you figured out. 🙂

Okay it looks like it's at least running python now, which is a good thing!

Looks like there's an issue in the adafruit-nrfutil script, let me see if I can get it to replicate locally.

@nitz
Copy link
Collaborator

nitz commented Nov 10, 2020

Hm, looks like there was a new version of adafruit-nrfutil published just a few days ago that specifically resolves issues with Python 3.9 by updating intelhex to 2.3.0.

If you do pip install --upgrade adafruit-nrfutil does it install 0.5.3.post13 (presumably over post12), or say that you already have that one? If it does install that, give it another build attempt.

@NBAPJ
Copy link
Author

NBAPJ commented Nov 10, 2020

Ok thanks I will keep my questions to this issue. One thing I noticed is that when I pip installed pyocd, intelhex, and adafruit-nrfutil it didn’t installed everything for them. I had to download their source code from github and open power shell in their folders and run the command python setup.py install and that installed their scripts and everything in my python folder. I’m about to do what you said and see if that helps.

@NBAPJ
Copy link
Author

NBAPJ commented Nov 10, 2020

ok so it updated

Using legacy 'setup.py install' for adafruit-nrfutil, since package 'wheel' is not installed.
Installing collected packages: adafruit-nrfutil
Attempting uninstall: adafruit-nrfutil
Found existing installation: adafruit-nrfutil 0.5.3.post12
Uninstalling adafruit-nrfutil-0.5.3.post12:
Successfully uninstalled adafruit-nrfutil-0.5.3.post12
Running setup.py install for adafruit-nrfutil ... done
Successfully installed adafruit-nrfutil-0.5.3.post13

But got a new error

$ make bootloader
Building UF2 bootloader...
C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe -C bootloader BOARD=odiin all
make[1]: Entering directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
LD odiin_bootloader-0.3.2-158-g23e6539-dirty.out
text data bss dec hex filename
31304 1572 22594 55470 d8ae _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty.out
Create odiin_bootloader-0.3.2-158-g23e6539-dirty.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Converting to uf2, output size: 72704, start address: 0x0
Wrote 72704 bytes to _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Create odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.hex
Zip created at _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.zip
make[1]: Leaving directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
Invalid number of parameters
0 File(s) copied
make: *** [Makefile:484: bootloader] Error 4

@NBAPJ
Copy link
Author

NBAPJ commented Nov 10, 2020

I searched for the error online and from my understanding I need to add quotations "" around the xcopy bootloader directory line in the MakeFile because the path to the directory has spaces in it and xcopy is not good reading white spaces.

Not sure if I'm right about the but here is the line I think need the quotations where do you think I should add them if I'm right about the error?

@xcopy $(BOOTLOADER_DIR)_build\build-$(BOOTLOADER_BOARD)$(BOOTLOADER_BOARD)_bootloader*nosd.hex $(OUTPUT_DIRECTORY)\ /R /Y

@NBAPJ
Copy link
Author

NBAPJ commented Nov 11, 2020

I was trying to fix it and messed something up now I'm getting this error

$ make bootloader
Building UF2 bootloader...
C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe -C bootloader BOARD=odiin all
make[1]: Entering directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
Invalid number of parameters
0 File(s) copied
make: *** [Makefile:484: bootloader] Error 4

@NBAPJ
Copy link
Author

NBAPJ commented Nov 11, 2020

I fixed the above error now I'm back to this one

Building UF2 bootloader...
C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe -C bootloader BOARD=odiin all
make[1]: Entering directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
CC dfu_ble_svc.c
CC dfu_init.c
CC flash_nrf5x.c
CC main.c
CC boards.c
CC pinconfig.c
CC nrfx_power.c
CC nrfx_nvmc.c
CC system_nrf52840.c
CC bootloader.c
CC bootloader_settings.c
CC bootloader_util.c
CC dfu_transport_serial.c
CC dfu_transport_ble.c
CC dfu_single_bank.c
CC ble_dfu.c
CC ble_dis.c
CC pstorage_raw.c
CC app_timer.c
CC app_scheduler.c
CC app_error.c
CC app_util_platform.c
CC crc16.c
CC hci_mem_pool.c
CC hci_slip.c
CC hci_transport.c
CC nrf_assert.c
CC msc_uf2.c
CC usb.c
CC usb_desc.c
CC ghostfat.c
CC dcd_nrf5x.c
CC tusb_fifo.c
CC usbd.c
CC usbd_control.c
CC cdc_device.c
CC msc_device.c
CC tusb.c
AS gcc_startup_nrf52840.S
LD odiin_bootloader-0.3.2-158-g23e6539-dirty.out
text data bss dec hex filename
31304 1572 22594 55470 d8ae _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty.out
Create odiin_bootloader-0.3.2-158-g23e6539-dirty.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Converting to uf2, output size: 72704, start address: 0x0
Wrote 72704 bytes to _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Create odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.hex
Zip created at _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.zip
make[1]: Leaving directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
Invalid number of parameters
0 File(s) copied
make: *** [Makefile:484: bootloader] Error 4
The terminal process "C:\Program Files\Git\bin\bash.exe '-c', 'make bootloader'" terminated with exit code: 2.

Terminal will be reused by tasks, press any key to close it.

@nitz
Copy link
Collaborator

nitz commented Nov 11, 2020

Yeah you def have the bootloader building. It's complaining now because it's failing to copy the produced file from the bootloader subproject to the main output directory. The fact that it's saying invalid number of parameters makes it seem like some of the variables aren't defined properly or something like that, which would be odd. Try removing the @ at the start of the xcopy command on line 484 of Makefile in the main Odiin directory. That'll make it not suppress the echoing of that command, so we should be able to see how exactly it's trying to call xcopy.

@NBAPJ
Copy link
Author

NBAPJ commented Nov 11, 2020

Ok I removed the @ before xcopy on on 484

Create odiin_bootloader-0.3.2-158-g23e6539-dirty.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Converting to uf2, output size: 72704, start address: 0x0
Wrote 72704 bytes to _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Create odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.hex
Zip created at _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.zip
make[1]: Leaving directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
xcopy bootloader_build\build-odiin\odiin_bootloader*nosd.hex _build\ /R /Y
Invalid number of parameters
0 File(s) copied
make: *** [Makefile:484: bootloader] Error 4

@nitz
Copy link
Collaborator

nitz commented Nov 11, 2020

Your xcopy command looks like it's not building the path properly. The makefile should be:

	@xcopy $(BOOTLOADER_DIR)\_build\build-$(BOOTLOADER_BOARD)\$(BOOTLOADER_BOARD)_bootloader*nosd.hex $(OUTPUT_DIRECTORY)\ /R /Y

And the BOOTLOADER_DIR definitely is resolving to bootloader right, but I don't see that slash between it and _build. Did that somehow get lost?

(As in, the actual command should look like xcopy bootloader\_build\build-odiin\odiin_bootloader*nosd.hex _build\ /R /Y)

@NBAPJ
Copy link
Author

NBAPJ commented Nov 11, 2020

So I should replace

xcopy $(BOOTLOADER_DIR)_build\build-$(BOOTLOADER_BOARD)$(BOOTLOADER_BOARD)_bootloader*nosd.hex $(OUTPUT_DIRECTORY)\ /R /Y

with

xcopy bootloader_build\build-odiin\odiin_bootloader*nosd.hex _build\ /R /Y)

@nitz
Copy link
Collaborator

nitz commented Nov 11, 2020

No, you should fix the original line. Or something is going on here that's eating your directory separators. The xcopy line is trying to copy the generated hex file out of the bootloader build directory to the main project build directory. In that line you just pasted there, it looks completely wrong, and I'm not sure how the slashes seem to have disappeared?

what you pasted: vvv
xcopy $(BOOTLOADER_DIR)_build\build-$(BOOTLOADER_BOARD)$(BOOTLOADER_BOARD)_bootloader*nosd.hex $(OUTPUT_DIRECTORY)\ /R /Y
xcopy $(BOOTLOADER_DIR)\_build\build-$(BOOTLOADER_BOARD)\$(BOOTLOADER_BOARD)_bootloader*nosd.hex $(OUTPUT_DIRECTORY)\ /R /Y
correct ^^^

Without those slashes, it'll never point at the correct file.

@NBAPJ
Copy link
Author

NBAPJ commented Nov 11, 2020

Here is whats in the makefile

bootloader:
ifeq ($(BOOTLOADER_EXISTS),0)
@echo Building UF2 bootloader...
$(MAKE) -C $(BOOTLOADER_DIR) BOARD=$(BOOTLOADER_BOARD) all
xcopy $(BOOTLOADER_DIR)_build\build-$(BOOTLOADER_BOARD)$(BOOTLOADER_BOARD)_bootloader*nosd.hex $(OUTPUT_DIRECTORY)\ /R /Y
@Move /y $(OUTPUT_DIRECTORY)$(BOOTLOADER_BOARD)_bootloader-*nosd.hex $(OUTPUT_DIRECTORY)$(BOOTLOADER_OUTFILE)
endif

Clean bootloader subproject

clean_bootloader:
@echo Cleaning UF2 bootloader...
$(MAKE) -C $(BOOTLOADER_DIR) BOARD=$(BOOTLOADER_BOARD) clean

Same Error

$ make bootloader
Building UF2 bootloader...
C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe -C bootloader BOARD=odiin all
make[1]: Entering directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
LD odiin_bootloader-0.3.2-158-g23e6539-dirty.out
text data bss dec hex filename
31304 1572 22594 55470 d8ae _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty.out
Create odiin_bootloader-0.3.2-158-g23e6539-dirty.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.hex
Create odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Converting to uf2, output size: 72704, start address: 0x0
Wrote 72704 bytes to _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty-nosd.uf2
Create odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.hex
Zip created at _build/build-odiin/odiin_bootloader-0.3.2-158-g23e6539-dirty_s140_6.1.1.zip
make[1]: Leaving directory 'C:/Users/melenese/Desktop/OdiinNFC2/Odiin/bootloader'
xcopy bootloader_build\build-odiin\odiin_bootloader*nosd.hex _build\ /R /Y
Invalid number of parameters
0 File(s) copied
make: *** [Makefile:484: bootloader] Error 4

@NBAPJ
Copy link
Author

NBAPJ commented Nov 12, 2020

Maybe this is better.
46861E88-D7D8-4543-804A-00C165C118F1

@NBAPJ
Copy link
Author

NBAPJ commented Nov 17, 2020

Hey do you think there is a command I can use besides xcopy?

@nitz
Copy link
Collaborator

nitz commented Nov 17, 2020

I don't have any knowledge of a command that's on windows already that will allow copies with wildcards. The wildcards are used because the filenames generated are based on git hashes.

If you run that same xcopy command from the command prompt, while in that folder, does it give you the same error? For the life of me, I can't see why it would fail like that.

@NBAPJ
Copy link
Author

NBAPJ commented Nov 17, 2020

Yea I ran it in command prompt and PowerShell as an administrator and it gives same error

@NBAPJ
Copy link
Author

NBAPJ commented Nov 17, 2020

I have bash on my computer also and it give the same error.

@nitz
Copy link
Collaborator

nitz commented Nov 17, 2020 via email

@phantomBlurrr
Copy link

Hi, were you able to figure out how to flash the device? Have been stuck trying to build bootloader/flash/etc.

@nitz
Copy link
Collaborator

nitz commented Jul 30, 2023

Hey @phantomBlurrr -- go ahead and open a separate issue and include as much detail as you can there and I'll try and help you out!

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

No branches or pull requests

3 participants