Dangerous Prototypes

Other projects => Open Bench Logic Sniffer => Topic started by: robots on January 13, 2011, 12:35:52 pm

Title: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on January 13, 2011, 12:35:52 pm
I have just finished this tool - Ols-fwloader. It is mostly intended for linux, but should work with windows and other platforms that do support libusb-1.0.

The source can be downloaded from:
https://github.com/robots/ols-fwloader (https://github.com/robots/ols-fwloader)

I have successfully tested it with my OLS, and it works fine. There is a little problem with first transaction, so don't get confused by the first "Com timeout".

The prerequisites are:
- gcc, and standard devel environment
- libusb-1.0

I have included lame Makefile, that does not use pkg-config, you probably will need to change the paths inside Makefile to make the compilation work.

I am looking for volunteers to  test it. Please just someone who has access to Buspirate, or other means of pic flashing. I have included several measures to protect the bootloader. But there is always a chance it will destroy its self. (The bootloader does not protect its self)
Title: Re: Brand new OLS bootloader tool - Linux
Post by: ian on January 13, 2011, 12:46:34 pm
This is a much welcome addition!

There is a big issue with this bootloader because the HID packet is 64 bytes, but the 24J50 has 2 and 64byte write sizes. I went with 2bytes per packet when I ported it. The 2550 (original chip for this bootloader) had 32byte write sizes, so it was much faster. We could speed it up a ton by using the 'flush flag' in the packet to send 2x32 byte packets for 64byte writes instead of 2 bytes per packet. The functionality should already be in the bootloader, I didn't implement it in software because working with the windows driver development kit was a nightmare.
Title: Re: Brand new OLS bootloader tool - Linux
Post by: ian on January 13, 2011, 12:52:03 pm
Quote
The bootloader does not protect its self

I guess I need to refresh myself on the bootloader code.

In this PIC, the flash config words are in the last two words of flash. Since there are two different crystal configurations out there, it is important to protect that region from overwrite. I forget how the bootloader does it. I think it erases by sector and the app doesn't process HEX above the last page, this just a guess, it's been a year since I ported the bootloader.
Title: Re: Brand new OLS bootloader tool - Linux
Post by: robots on January 13, 2011, 01:13:20 pm
On erase the bootloader erases all pages except first two, and last one. But does not protect them from being written to. You can still write stuff to 0.
Title: Re: Brand new OLS bootloader tool - Linux
Post by: robots on January 13, 2011, 01:23:49 pm
The larger "page" would help:
Old code:
Code: [Select]
robot@robot ~/devel-DP/ols-fw $ time ./ols-fwloader -V -W -w working.bin 
Bootloader version 0.2.2
Bootloader version 0.2.2
Erasing flash ...
Writing flash ... (0x0800 - 0x4000)
Protecting bootloader - skip @0x3bfe
Checking flash ...
Verified OK! :)

real 0m35.225s
user 0m0.074s
sys 0m0.261s
New code:
Code: [Select]
time ./ols-fwloader -V -W -w working.bin 
Bootloader version 0.2.2
Bootloader version 0.2.2
Erasing flash ...
Writing flash ... (0x0800 - 0x4000)
Protecting bootloader - skip @0x3be0
Checking flash ...
Verify failed :(

real 0m4.019s
user 0m0.001s
sys 0m0.036s

Only problem is the Verify fail. It doesn't seem to write all the data, just some random 2 bytes, skips rest. (random position correct data).
I do understand the bootloader code a bit, but I am not familiar with the way flash is written. I am uploading the changed code to the github. There is OLS_PAGE_SIZE option in the ols-boot.h file. 64 or 2 is valid here, and it selects which code is going to be used.
Title: Re: Brand new OLS bootloader tool - Linux
Post by: robots on January 13, 2011, 02:49:56 pm
It seems that it only writes every 64th word, (last two bytes of 128 byte memory piece). And i wonder if it is mine error, or error in bootloader.
Title: Re: Brand new OLS bootloader tool - Linux
Post by: ian on January 13, 2011, 02:53:19 pm
probably the bootloader, I only implemented the alternating writes in theory. There might actually be a bit or command you need to send first to get it in 64byte write mode, then you alternate the 'flushflag' bit of the HID packet (see the struct int he old fw-update source) to tell it to first)buffer the packet, and second)write the second packet and save to flash.

I can take a look soon, but maybe not until tomorrow.
Title: Re: Brand new OLS bootloader tool - Linux
Post by: ian on January 13, 2011, 03:38:03 pm
Found a few minutes:

Code: [Select]
;-----------------------------------------------------------------------------
;       write_code
;-----------------------------------------------------------------------------
; DESCR :
; INPUT : boot_cmd
; OUTPUT:
; NOTES : Assume TBLPTRU=0
;-----------------------------------------------------------------------------
write_code
; TBLPTR = addr
rcall load_address_size8 ; TBLPTR=addr cntr=size8 & 0x3C
lfsr FSR0,boot_cmd + CODE_OFFS ; FSR0=&boot_cmd.data
tblrd*- ; TBLPTR--

; while( cntr-- )
write_code_loop
movff POSTINC0, TABLAT
tblwt+* ; *(++Holding_Register) = *data++
; incf hold_r ; hold_r++
; btfsc hold_r, 5 ; if( hold_r == 0x20 )  End of Holding Area
; rcall flash_write ;     write_flash       Dump Holding Area to Flash
decfsz cntr
bra write_code_loop

; tstfsz hold_r ; if( hold_r != 0 )     Holding Area not dumped
; tstfsz boot_cmd + FLUSH_OFFS ; if packet says flush, save to eeprom
btfsc boot_cmd + FLUSH_OFFS, 0 ;if bit 0 is set, write the data
rcall flash_write ;       write_flash     Dump Holding Area to Flash

        return

This is from boot_asm.asm, the actual write function. It is pretty open. It moves cntr bytes from the USB packet to the PIC flash write buffer. I'm not 100% sure where cntr comes from, but I think there is a size variable in the HID packet.

Quote
   btfsc boot_cmd + FLUSH_OFFS, 0   ;if bit 0 is set, write the data
   rcall   flash_write   ;       write_flash     Dump Holding Area to Flash
        return

If BIT 0 of the FLUSH flag is set (is set on every packet for the 2byte writes), then it calls the flash write function. Other wise it waits for next packet.

Code: [Select]
;-----------------------------------------------------------------------------
; Local Functions
;-----------------------------------------------------------------------------
; cntr = boot_rep_size8 = boot_cmd.size8 & 0x3C
load_address_size8
movf boot_cmd + SIZE_OFFS, W
;andlw 0x3C ;!!! 18f24j50
movwf cntr
movwf boot_rep + SIZE_OFFS

; TBLPTR = boot_rep.addr = boot_cmd.addr; hold_r = boot_cmd.addr_lo & 0x1F
load_address
movf boot_cmd + ADDR_HI_OFFS, W
movwf TBLPTRH
movwf boot_rep + ADDR_HI_OFFS
movf boot_cmd + ADDR_LO_OFFS, W
movwf TBLPTRL
movwf boot_rep + ADDR_LO_OFFS
andlw 0x1F
movwf hold_r
return

; write flash (if EECON1.FREE is set will perform block erase)         
flash_write
bcf EECON1, WPROG ; 64byte writes
btfsc boot_cmd + FLUSH_OFFS, 1 ;if bit 1 is set, this is a 2byte write
bsf EECON1, WPROG ; 2byte writes
; write eeprom EEADR,EEDATA must be preset, EEPGD must be cleared      
eeprom_write
; bcf EECON1, CFGS ; Access code memory (not Config)
bsf EECON1, WREN ; Enable write
movlw 0x55
movwf EECON2
movlw 0xAA
movwf EECON2
bsf EECON1, WR ; Start flash/eeprom writing
clrf hold_r ; hold_r=0
return
;-----------------------------------------------------------------------------

The local functions.

Quote
   bcf   EECON1, WPROG   ; 64byte writes
   btfsc boot_cmd + FLUSH_OFFS, 1   ;if bit 1 is set, this is a 2byte write
   bsf   EECON1, WPROG   ; 2byte writes

Flash write sets a 64byte write, but if BIT 1 of the FLUSH byte is set it turns it back to a 2byte write mode. It then activates the write.

I think the load_address functions grab the size and write address from the data packet.

Code: [Select]
;-----------------------------------------------------------------------------
; Constants
;-----------------------------------------------------------------------------
; boot_cmd & boot_rep
CMD_OFFS equ 0
ID_OFFS equ 1
ADDR_LO_OFFS equ 2
ADDR_HI_OFFS equ 3
FLUSH_OFFS equ 4
SIZE_OFFS equ 5
CODE_OFFS equ 6
VER_MAJOR_OFFS equ 2
VER_MINOR_OFFS equ 3
VER_SMINOR_OFFS equ 4
EEDATA_OFFS equ 6

Here is the ASM define of the packet, the C version in the fw-update app is probably clearer. The key is the FLUSH_OFFS bit 0 determines when we write, and FLUSH_OFFS bit 1 sets a 2 or 64 byte write.

None of this is to say that it actually works :)
Title: Re: Brand new OLS bootloader tool - Linux
Post by: robots on January 14, 2011, 08:44:29 pm
I see where the problem is. I have not seen the bit 1 check. I will try the modified loader in few minutes.
Title: Re: Brand new OLS bootloader tool - Linux
Post by: robots on January 14, 2011, 09:18:24 pm
The most recent version in git works :-) Flashes OLS in 3.5seconds on my EEEpc. (thats erase write verify).

I have an idea how to implement the same thing in fw_updater. Or I could add windows support to this project.

There are still few things missing - correct error handling for some function calls, integration with ols-loader (so there is just one ultimate tool for ols).

Any suggestions ?
Title: Re: Brand new OLS bootloader tool - Linux
Post by: jawi on January 14, 2011, 09:56:27 pm
Most of the time, I get confused on which program to use for what part of the firmware. So, I vote for a one-tool-to-rule-them-all! ;)
Good work, keep it up...
Title: Re: Brand new OLS bootloader tool - Linux
Post by: ian on January 15, 2011, 10:10:21 am
I'm glad it worked, that's a huge speed increase. Speeds comparable to the 18F version that uses 32/packet writes.

I think windows support on the new utility would be better than continuing to work fw_update, it's a huge beast.
Title: Re: Brand new OLS bootloader tool - Linux
Post by: robots on January 15, 2011, 08:29:05 pm
I am slowly getting there. Next step will be win32 support.

I have created branch in the git repository, with combined tool. Branch name is "ols-combined". This tool can update SPI flash or PIC Application from one place. It does support only one memory at time.

Example: Ols in update mode, entered by button press.
Code: [Select]
./ols-fwloader -f BOOT -n -V -W -w ./working.bin -P /dev/ttyACM0
Found OLS HW: 1, FW: 2.1, Boot: 1
Found flash: ATMEL AT45DB041D
OLS switched to bootloader mode
Bootloader version 0.2.2
Bootloader version 0.2.2
Erasing flash ...
Reading file './working.bin'
Writing flash ... (0x0800 - 0x4000)
Protecting bootloader - skip @0x3be0
Checking flash ...
Verified OK! :)

SPI flash read erase write and verify:
Code: [Select]
./ols-fwloader -f APP -R -W -V -w aasas.bin -r aasas.bin -P /dev/ttyACM0
Found OLS HW: 1, FW: 2.1, Boot: 1
Found flash: ATMEL AT45DB041D
Reading flash
................................................................
Writing file 'aasas.bin'
Erasing flash ...
Chip erase ... done :)
Reading file 'aasas.bin'
Will write 2048 pages
................................................................
Checking flash ...
Verified OK! :)

Some interaction from user is, however, needed. There is no way to exit bootloader to update mode.  It would make complete update process easier.
As before, I have only tested it on prototype OLS and would be glad if someone else could try it !.

Also I have not copied some features like ignore jedec, as it is not appropriate with multiple SPI flash types. If such feature is desired, I will add it. Also any other suggestions are welcome :)
Title: Re: Brand new OLS bootloader tool
Post by: robots on January 17, 2011, 10:18:02 pm
I have compiled my new loader for windows. It compiles nicely under CodeBlocks. I have also included CB project in the git.

I have uploaded compiled version here:
http://robot.mysteria.cz/ols-fwloader.exe (http://robot.mysteria.cz/ols-fwloader.exe)

What i have not tested is the serial part. As it is kinda annoying to do in vmplayer :( Could someone give it a try ?
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: ian on January 18, 2011, 12:33:13 pm
Thanks robots,

I tried it out:
*-n jump: it gives 'device not found' error, ends. OLS IS in update mode though
*update without -n gives the attached verify error
*bitstream update works great

Maybe I used a wrong option for the FW part?
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 18, 2011, 03:56:39 pm
-n does wait 1 second for the device and then tries to connect. 1 second is long enough for linux. I RTFM and Sleep in windows does sleep in ms not s.
- I have not tested veryfy with .hex, i need to set the buffer to 0xff for it to work.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 18, 2011, 04:08:40 pm
i have reuploded new binary, can you check the problems now ? 
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: ian on January 19, 2011, 09:36:51 am
Thanks for the update. I tried it again with slightly improved results:

*First fw update jumped to bootloader OK, seems to program OK (OLS keeps working), verify fail
*Second fw update failed jump to bootloader. I did a couple tests: it will work if it has just been plugged in. It always fails if I press reset and hold update to enter ROM update mode. It does not seem to wait a full second, but I'm not timing it or anything.
*Bitstream update completes ok, but the device never loads, so I guess it was mangled in some way.

Test screenshots attached. I created a test rig for your prog, so if you have other updates I can test them quickly and easily from now on.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 19, 2011, 11:39:20 am
I am having difficulties communicating with OLS in my setup (Windows + Vmplayer = disaster :( ). The FW update works fine, but serial port communication is broken. I have increased the timeout to 2seconds (1 second was too little).  The verification should be fixed as well, it should only verify the application and not fuses.

I have uploaded new version that has "-d" parameter, It will print where the differences are in verification. You will probably want to output into a file like "ols-fwloader xxxxx > file.txt"
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 19, 2011, 11:47:02 am
I have tested it on windows (actuall laptop with windows) and it seems to work correctly.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: ian on January 19, 2011, 12:36:24 pm
Nice job, the firmware works great no matter what I do to it.

Does the bitstream loader also default to BIN? I used a .hex first and the FPGA didn't load. Then I noticed the page count and did it again with a .bit and it worked ok.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 19, 2011, 01:09:53 pm
Both default to BIN, I can make it hex for firmware and Bin for bitstream.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: ian on January 19, 2011, 01:13:08 pm
It's probably best to be consistent and keep them both bit or HEX. I would suggest HEX as the default because it requires the least processing for firmware and bitstream releases.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 19, 2011, 01:29:07 pm
I have changed default type to HEX, and attached are compiles for linux and windows.

More trials are welcome :-)
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: ian on January 19, 2011, 01:30:39 pm
I've got a post queued too.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: zelea2 on January 19, 2011, 06:03:41 pm
The combined tool ols-fwloader (2nd post above) works fine for me in BIOS mode but not in APP mode:
I'm using a working board which I can use in the OLS client

$ dmesg
cdc_acm 6-2:1.0: ttyACM0: USB ACM device
$ ll /dev/ttyACM0
crw-rw-rw- 1 root dialout 166, 0 Jan 19 17:00 /dev/ttyACM0

% TRIG led is on

$ ./ols-fwloader -f APP -P /dev/ttyACM0 -R -r dump.hex
Found OLS HW: 0, FW: 0.0, Boot: 0
Error - unknown flash type (00 00 00 00)
Unable to read Flash ID
Unable to open OLS

% now the ARM led is ON and if I'm running it again it waits 5 seconds and then displays:

$ ./ols-fwloader -f APP -P /dev/ttyACM0 -R -r dump.hex
Error reading OLS id
Unable to read ID
Unable to open OLS
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 19, 2011, 06:17:05 pm
Quote
Error - unknown flash type (00 00 00 00)

This means you are not in update mode. I should probably add check for that.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: zelea2 on January 19, 2011, 06:36:04 pm
What update mode ?

In PIC update firmware mode with the jumper on all is fine

$ sudo ./ols-fwloader -f BOOT -V -w OLSv1-firmware-v2.1.hex
Bootloader version 0.2.2
Bootloader version 0.2.2
Checking flash ... (0x0800 - 0x3c00)
Verified OK! :)

In this mode the update happens directly over the USB VID/PID device

Run it a second time gives
$ sudo ./ols-fwloader -f BOOT -V -w OLSv1-firmware-v2.1.hex
Com timeout

A third time works again

Now if I remove the jumper to enumerate the ACM0 port I get the errors from the previous post.

The example you give in the help screen doesn't work at all; it just prints the help again
Write FPGA bitstream:
 ols-fwloader -f APP -W -w bitstream.hex

How am I supposed to use the upgrader in APP mode?
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 19, 2011, 06:40:04 pm
jumper is for bootloader entry. Update mode is entered by pressing update button and reseting/starting the device. The led next to power led should be lit and solid. In this mode you can access the SPI flashrom for bitstream update.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: zelea2 on January 19, 2011, 07:04:05 pm
My mistake, I completely forgot about that button trick since the last time I did it.

$ ./ols-fwloader -f APP -P /dev/ttyACM0 -R -r dump.hex
Found OLS HW: 1, FW: 2.1, Boot: 1
Found flash: ATMEL AT45DB041D
Reading flash

Now it works; You should maybe mention it as an error message.
Also please update the example for the APP mode because it's easier to paste the command with the mouse.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 19, 2011, 07:16:02 pm
[quote author="zelea2"]
Also please update the example for the APP mode because it's easier to paste the command with the mouse.
[/quote]

What do you mean ?
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 19, 2011, 07:30:09 pm
The example cannot be made simple to use. I should be as pointer, but i cannot determine the port of your OLS. If it's harder to copy, it will make you think more about what you are actually doing.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: wayoda on January 20, 2011, 01:37:05 pm
Hi,
I build the latest version of the tool from scratch, and the command below killed my OLS completely. 
Code: [Select]
wayoda@rebooter:~/lab/ols/code/ols-fwloader$ ./ols-fwloader -f BOOT -n -P /dev/OpenLogicSniffer -V -W -w ../../downloads/updates/OLSv1-FW2.1-final-1/OLSv1-firmware-v2.1.hex  
Found OLS HW: 1, FW: 0.6, Boot: 1
Found flash: ATMEL AT45DB041D
OLS switched to bootloader mode
Bootloader version 0.2.2
Bootloader version 0.2.2
Erasing flash ...
Reading file '../../downloads/updates/OLSv1-FW2.1-final-1/OLSv1-firmware-v2.1.hex'
file won't fit into buffer :(
Writing flash ... (0x0800 - 0x0000)
Protecting bootloader - skip @0x3be0
Checking flash ...
file won't fit into buffer :(
Verify failed :(
The OLS is not even enumerated on the USB any more, so I guess the bootloader was erased/overwritten??
I did not set the [tt:]-t HEX[/tt:] flag. Could that be the reason for failure?
Wouldn't it make sense to check the file-format (using the extension and/or the well defined IntelHex Format) in future releases?

But having a combined tool for both update procdures is definatly the right way.

I do have a second board, so I'm not really worried, but how do I restore my broken board now?
I guess I need a PIC programmer?
Here in Germany the currently offer the "PICkit 3 Debug Express it 3" at a discount price, any advice on buying this one?
(I would go for a BusPirate and the Programmer-Adapter, but I'd have to order the Programmer-Adapter from China. When I ordered the 2 OLS boards last year, they where hostages of the German Customs for 2 weeks. So much for globalization when its NOT about exporting stuff from Germany.)

Eberhard
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: ian on January 20, 2011, 01:50:08 pm
You can get a Bus Pirate from Watterot or ehajo in .de if you don't have one. The 18F24J50 on the OLS does NOT require the HVP adapter, you can program it directly.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: wayoda on January 20, 2011, 02:00:28 pm
[quote author="ian"]
You can get a Bus Pirate from Watterot or ehajo in .de if you don't have one. The 18F24J50 on the OLS does NOT require the HVP adapter, you can program it directly.
[/quote]
Thanks Ian, great news! I'd rather support DG then.

Eberhard
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 20, 2011, 02:14:02 pm
You have not killed your bootloader !, just use jumper to enter bootloader and upload the firmware again. using correct format.

I have made HEX default format, but the changes didn't make it to github. Sorry about that!.

Edit: Precompiled versions have default type set to HEX
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: wayoda on January 20, 2011, 02:54:32 pm
Hi, robots
[quote author="robots"]
You have not killed your bootloader !, just use jumper to enter bootloader and upload the firmware again. using correct format.

I have made HEX default format, but the changes didn't make it to github. Sorry about that!.

Edit: Precompiled versions have default type set to HEX
[/quote]
Right, it's alive again.
It was a bit of surprise to me (but obvious when you think about it), that the OLS disappeared completely from the USB.

Eberhard

P.S. Ian will be happy to hear that I ordered the BP anyway
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: ian on January 20, 2011, 03:03:56 pm
Quote
P.S. Ian will be happy to hear that I ordered the BP anyway

Sorry about that, I didn't mean to push unneeded hardware. Did you get a probe cable? I can send you a free one.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: wayoda on January 20, 2011, 07:35:43 pm
[quote author="ian"]
Quote
P.S. Ian will be happy to hear that I ordered the BP anyway

Sorry about that, I didn't mean to push unneeded hardware. Did you get a probe cable? I can send you a free one.
[/quote]
Nothing to be sorry about Ian, I ordered after repairing the OLS. I have good use for the BP.
Thanks for the probe cable offer, but I'm using breadboard patchcables most of the time.
 
Eberhard
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: jawi on January 27, 2011, 02:22:04 pm
I've been testing the ols-combined tool a bit. Attached are two patches that I've created to improve it:


HtH,
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 27, 2011, 04:49:06 pm
Thanks for testing :-) I have pushed the changes to github.

(I changed the spaces to tabs to be consistent.)
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 28, 2011, 10:37:04 am
I'm in the lab now, finally done with my gruesome project course. I will test it tonight and see how it goes. Anything I should watch for in particular? Any tests that you recommend?
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 28, 2011, 12:49:24 pm
nothing specific, but if you find anything anoying/not working/worth improvement let me know.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 31, 2011, 01:59:37 pm
Got the following output:

Code: [Select]
tayken@tayken-eee:~/Downloads/robots-ols-fwloader-42550c9$ ./ols-fwloader -V -W -w ../ols-firm/OLSv1-firmware-v2.1.hex 
Bootloader version 0.2.2
Bootloader version 0.2.2
Erasing flash ...
file won't fit into buffer :(
Writing flash ... (0x0800 - 0x0000)
Protecting bootloader - skip @0x3be0
Checking flash ...
file won't fit into buffer :(
Verify failed :(

Cannot connect to my OLS now. But I'll fix it using the regular tools.
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 31, 2011, 02:12:54 pm
Are you sure you are using the latest git version ? (the one in ols-combined branch)

The latest version wont erase flash when file not loaded, and does have hex as default filetype.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 31, 2011, 02:30:44 pm
I downloaded on 28th, so I guess this is the last version, from https://github.com/robots/ols-fwloader (https://github.com/robots/ols-fwloader)
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 31, 2011, 02:31:37 pm
Sorry, forgot to do the branch switching. Never used git before :)
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 31, 2011, 02:41:20 pm
Here is the result:

Code: [Select]
tayken@tayken-eee:~/Downloads/robots-ols-fwloader-b58e7dd$ ./ols-fwloader -f BOOT -n -P /dev/OLS -V -W -w ../ols-firm/OLSv1-firmware-v2.1.hex 
Found OLS HW: 1, FW: 2.1, Boot: 1
Found flash: ATMEL AT45DB041D
OLS switched to bootloader mode
Bootloader version 0.2.2
Bootloader version 0.2.2
Reading file '../ols-firm/OLSv1-firmware-v2.1.hex'
Erasing flash ...
Writing flash ... (0x0800 - 0x3c00)
Protecting bootloader - skip @0x3be0
Checking flash ... (0x0800 - 0x3c00)
Verified OK! :)
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 31, 2011, 02:48:07 pm
I have merged the branches into master, so less confusion happens :) will remove the old branch once i figgure out how-to ...
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 31, 2011, 02:58:11 pm
Is the FPGA update implemented in this? I tried it as in the help menu but couldn't succeed.
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 31, 2011, 03:05:34 pm
It is.

-P /dev/ttyACM0 -f APP -W -V -w file_to_write.hex (-t BIN if it is binary file)
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 31, 2011, 03:15:34 pm
Gives "Unknown file type" error with: ./ols-fwloader -f BOOT -n -P /dev/OLS -V -W -t ../2.12TestRelease/2.12/Logic_Sniffer_dynamic_depth.bit (and also same with .mcs file)
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 31, 2011, 05:40:51 pm
it shoud be

./ols-fwloader -f app -n -P /dev/OLS -V -W -w ../2.12TestRelease/2.12/Logic_Sniffer_dynamic_depth.bit -t BIN
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 31, 2011, 06:14:20 pm
Also tried that, no success:

Code: [Select]
tayken@tayken-eee:~/Downloads/robots-ols-fwloader-b58e7dd$ ./ols-fwloader -f app -n -P /dev/OLS -V -W -w ../2.12TestRelease/2.12/Logic_Sniffer_dynamic_depth.bit -t bin
Found OLS HW: 1, FW: 2.1, Boot: 1
Found flash: ATMEL AT45DB041D
OLS switched to bootloader mode
Reading file '../2.12TestRelease/2.12/Logic_Sniffer_dynamic_depth.bit'
Erasing flash ...
Cannot erase unknown flash
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 31, 2011, 06:33:24 pm
ok i see the problem now. "-n" parameter should not be there. I have fixed the source to disregard it when not using bootloader.
Title: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: tayken on January 31, 2011, 07:25:26 pm
That solved my problem!

Code: [Select]
tayken@tayken-eee:~/Downloads/robots-ols-fwloader-b58e7dd$ ./ols-fwloader -f app -P /dev/OLS -V -W -w ../2.12TestRelease/2.12/Logic_Sniffer_dynamic_depth.bit -t bin
Found OLS HW: 1, FW: 2.1, Boot: 1
Found flash: ATMEL AT45DB041D
Reading file '../2.12TestRelease/2.12/Logic_Sniffer_dynamic_depth.bit'
Erasing flash ...
Chip erase ... done :)
Will write 642 pages
.....................
Checking flash ...
.....................
Verify OK

Very cool robots!  Also did some minor editing to the main.c file, starting from line 62, changed it into:

Code: [Select]
	printf("nn");
printf("Write PIC firmware with verification, enter bootloader first:n");
printf(" ols-fwloader -f BOOT -n -P /dev/ttyACM0 -V -W -w firmware.hex  n");
printf("Write FPGA bitstream:n");
printf(" ols-fwloader -f APP -P /dev/ttyACM0 -V -W -w bitstream.bit -t BINn");
printf("n");

So that I don't have to remember what to write each time I run the program. :)
Title: Re: Re: Brand new OLS bootloader tool - Windows and Linux
Post by: robots on January 31, 2011, 07:35:37 pm
I have made similar change :-) thanx
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on February 01, 2011, 08:28:40 am
Nice work, it seems like the app has stabilized. I started a page for it on the wiki with the current links:
http://dangerousprototypes.com/docs/Log ... pplication (http://dangerousprototypes.com/docs/Logic_Sniffer:_Comprehensive_update_application)

I will add links to final compiles and examples when available.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 01, 2011, 09:31:54 am
here is executable of the latest git version. I have compiled it for linux, and crosscompiled for win32. I hope it works :)
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 01, 2011, 02:11:38 pm
I tried to compile it from source, but am not successful. It looks like it needs an include file 'libusb.h', which is missing on my system (Ubuntu 10.4 LTS). I have libusb-dev installed and it provides a 'usb.h' file instead. But even if I change 'ols-boot.h' to include 'usb.h' instead of 'libusb.h' I get the same compile error.

So it looks to me ols-loader has another prerequisite than libusb-dev.

Code: [Select]
$ make
gcc  -I/usr/include/libusb-1.0  -c main.c
In file included from main.c:13:
ols-boot.h:11:20: error: libusb.h: No such file or directory
In file included from main.c:13:
ols-boot.h:35: error: expected specifier-qualifier-list before ‘libusb_context’
make: *** [main.o] Error 1
Markus
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: tayken on February 01, 2011, 04:39:58 pm
I'm using the same system (Ubuntu 10.04 LTS). I installed libusb-1.0-0-dev package, that can solve your problem.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 01, 2011, 07:02:40 pm
Yes, you are right, installing libusb-1.0-0-dev in addition to libusb-dev solves the problem. It looks like these share the same name, but are two different beasts. What a mess !

Thanks  Markus
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 01, 2011, 07:12:33 pm
it is ment for libusb-1.0 I am not sure about ubuntu and it's library versions. I should probably update the makefile to make it less system specific.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 01, 2011, 09:52:58 pm
There is no point to change the Makefile, you need the 'libusb-1.0-0' library and not the 'libusb' library. These two are two distinct different entities. Thats why I qualify this as mess.

But you could mention in the readme that the 'libusb-1.0-0' library is needed and that 'libusb' is something different which is not sufficient.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 01, 2011, 10:01:28 pm
On gentoo it's libusb. The library its self is libusb-1.0. But let's not get into package naming discussion.

I will add autotools configure, that will check everything. I just need to learn how to.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 01, 2011, 11:31:53 pm
Don't worry, a few words about the libraries needed in the README will suffice.

Now, for me the compile problem is solved, thanks.

Unfortunately, I'm still unable to use ols-fwloader correctly. At the moment I'm struggling with very basic functions (and probably understanding).

I have my OLS since last summer and have no idea what the version of the boot loader, the PIC firmware and the FPGA bitstream is. I'm not even sure if I name there items correctly and if the list is exhaustive. So I have plenty of questions:

1) If I run: ols-fwloader -f BOOT -n -V -w PIC_firmware/OLSv1-firmware-v2.1.hex
    I suppose this will fetch the PIC firmware and compare it to the file named, this way I can check if I'm at a certain firmware level. There seems to be no way to determine directly at which firmware level I'm at.

2) There seems to be contradictions in the help information: If I run 'ols-fwloader -f BOOT -n' I get the error message 'Missing port' (the -P <port> is missing) even though the '-n' flag is in the 'BOOT only' and the '-P' flag is in the 'APP only' options. I would assume the two options are mutually exclusive.

3) I don't quite understand the notions 'BOOT' and 'APP'. I'm inclined to think 'BOOT' is the PIC firmware (*not* the boot loader) and 'APP' is the fpga bitstream. Is that correct ?

4) I suppose I have to place the OLS into 'update mode' (ACT and PWR leds lit) before launching 'ols-fwloader'. I don't quite understand the '-n' 'enter bootloader first' option. Does this option allows me to run the 'ols-fwloader' without the OLS being placed in 'update mode' ?

5) Last, but not least, when I run the command 'ols-fwloader -f BOOT -V -w PIC_firmware/OLSv1-firmware-v2.1.hex'
  I get the error 'Device not found' (independent of the OLS being in 'update mode' or not). I can access it using the Java sump client with no problem, though...

Sorry to bother with that many questions, but I'm a bit lost in (OLS-) space. I suppose most of the answers to this should go into the wiki page mentioned earlier in this thread.

Markus
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on February 02, 2011, 07:53:42 am
I can help with some of these:

Quote
1) If I run: ols-fwloader -f BOOT -n -V -w PIC_firmware/OLSv1-firmware-v2.1.hex
I suppose this will fetch the PIC firmware and compare it to the file named, this way I can check if I'm at a certain firmware level. There seems to be no way to determine directly at which firmware level I'm at.
In ROM update mode the program will read and report the bootloader, PIC firmware, and hardware version. There is no way to tell the FPGA version without reading the bitstream and verifying it against a known source.

Quote
4) I suppose I have to place the OLS into 'update mode' (ACT and PWR leds lit) before launching 'ols-fwloader'. I don't quite understand the '-n' 'enter bootloader first' option. Does this option allows me to run the 'ols-fwloader' without the OLS being placed in 'update mode' ?

No. The bootloader is entered by placing a jumper between PGC and PGD - OR - an application can send a command and jump to the bootloader from ROM update mode. -n sends the command and jumps to bootloader mode after updating the ROM.

Quote
5) Last, but not least, when I run the command 'ols-fwloader -f BOOT -V -w PIC_firmware/OLSv1-firmware-v2.1.hex'
I get the error 'Device not found' (independent of the OLS being in 'update mode' or not). I can access it using the Java sump client with no problem, though...

If you do not use the app to jump from ROM to bootloader mode, then it will not be detected. Try using the -n option, or enter bootloader mode manually by connecting the PGC and PGD pins of the ICSP header and resetting. The OLS will enumerate as a HID device.

I highly recommend Logic Sniffer 101, it has an introduction to the different modes, how to enter them, and what they do:
http://dangerousprototypes.com/docs/Logic_Sniffer_101 (http://dangerousprototypes.com/docs/Logic_Sniffer_101)
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 02, 2011, 09:36:59 am
Thanks Ian,

re-reading that page started to clear things up. Having a night of sleep in between helped too :-).

I've updated stuff on the wiki page at http://dangerousprototypes.com/docs/Log ... pplication (http://dangerousprototypes.com/docs/Logic_Sniffer:_Comprehensive_update_application)

Can you re-read to verify that I did not say something wrong ?
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: tayken on February 02, 2011, 09:54:00 am
I did some minor editing in the usage part, examples are now as in main.c file.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on February 02, 2011, 10:01:54 am
Thanks markus,

The updates look great. The only thing I would add is that the new utility can do both operations at once - first update the bitstream, then jump to the bootloader and update the PIC firmware.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 02, 2011, 10:18:12 am
[quote author="tayken"]I did some minor editing in the usage part, examples are now as in main.c file.[/quote]

Aand where do i find it ? :-)

[quote author="ian"]Thanks markus,

The updates look great. The only thing I would add is that the new utility can do both operations at once - first update the bitstream, then jump to the bootloader and update the PIC firmware.[/quote]

This will probably not happen to the tool. You can always write script that will run the 2 commands. :-)

One thing that would help, command in the firmware that would enter update mode. Something like triggering RTS line (on virtual com). This way you could really update, without users interaction.

Quote
3) I don't quite understand the notions 'BOOT' and 'APP'. I'm inclined to think 'BOOT' is the PIC firmware (*not* the boot loader) and 'APP' is the fpga bitstream. Is that correct ?

Boot means you want to talk to the bootloader. App means you want to talk to the application.

Quote
2) There seems to be contradictions in the help information: If I run 'ols-fwloader -f BOOT -n' I get the error message 'Missing port' (the -P <port> is missing) even though the '-n' flag is in the 'BOOT only' and the '-P' flag is in the 'APP only' options. I would assume the two options are mutually exclusive.

Yes if you look at it this way, it is a contradiction. But to enter bootloader from update mode, you need to be able to speak with the device. Switching to bootloader will make APP only switches useless.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on February 02, 2011, 10:39:05 am
Quote
    ian wrote:Thanks markus,

    The updates look great. The only thing I would add is that the new utility can do both operations at once - first update the bitstream, then jump to the bootloader and update the PIC firmware.



This will probably not happen to the tool. You can always write script that will run the 2 commands. :-)


Sorry, I thought it did this already. I just meant to add it to the documentation.

I'll see about adding an easier jump from firmware to ROM update mode, that is a great idea.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 02, 2011, 10:43:00 am
I forgot.

[quote author="markus_b"]Don't worry, a few words about the libraries needed in the README will suffice.

Now, for me the compile problem is solved, thanks.
[/quote]

This it what is called Worksforme state. It may work for you, but will not work on other systems where the headers/libs are not in the same location. So autotools is the best choice.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 02, 2011, 10:46:22 am
I still have questions :-).

The 'ols-fwloader' always uses serial port emulation to connect to either the APP loader (update FPGA firmware) or the BOOT loader (update PIC firmware). What is the use of the '-p pid' and '-v vid' flags ?

Could we change the error message, when you can not connect from 'Device not found' to 'Could not connect to device <vid>,<pid>: Is the OLS in update mode ?'.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 02, 2011, 10:49:36 am
[quote author="robots"]This it what is called Worksforme state. It may work for you, but will not work on other systems where the headers/libs are not in the same location. So autotools is the best choice.[/quote]
Yes, a proper 'configure' script would be great. It does not address the confusion about the two (incompatible) libusb libraries (libusb and libusb-1.0) though. This is what I think should be addressed in the README.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: tayken on February 02, 2011, 10:53:13 am
It's in wiki: http://dangerousprototypes.com/docs/Log ... pplication (http://dangerousprototypes.com/docs/Logic_Sniffer:_Comprehensive_update_application) :)
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 02, 2011, 11:04:57 am
[quote author="ian"]Sorry, I thought it did this already. I just meant to add it to the documentation.

I'll see about adding an easier jump from firmware to ROM update mode, that is a great idea.[/quote]

Ian, is there a way to obtain the software levels in 'update mode' and from the boot loader ?

I think it would be good to define a fixed location in the binary images (firmware and bitstream) to hold a version number or build ID (a 16bit int is probably sufficient). This would allow querying and displaying these in 'update mode' quite easily. At least the bitstream version should be available to the (java) client as well.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 02, 2011, 11:08:07 am
[quote author="markus_b"]I still have questions :-).

The 'ols-fwloader' always uses serial port emulation to connect to either the APP loader (update FPGA firmware) or the BOOT loader (update PIC firmware). What is the use of the '-p pid' and '-v vid' flags ?

Could we change the error message, when you can not connect from 'Device not found' to 'Could not connect to device <vid>,<pid>: Is the OLS in update mode ?'.[/quote]

Vid/pid is set internally to the vid/pid of bootloader, those two parameters are for overriding the default.

And it is not always using serial port emulation. in bootloader mode it is using serial port emulation just to enter bootloader mode, afterwards raw usb communication continues. (that's why it needs libusb)

I will try to add more sense to the error messages.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on February 02, 2011, 12:16:28 pm
Quote
Ian, is there a way to obtain the software levels in 'update mode' and from the boot loader ?

Do you mean versions? Or the current mode? In ROM update mode ols-loader can read and report the bootloader, PIC firmware, and hardware version. Note that the bootloader version is OUR bootloader version, not the manufacturer's protocol version that is reported in the bootloader mode. This is also documented on the wiki: http://dangerousprototypes.com/docs/Log ... e_protocol (http://dangerousprototypes.com/docs/Logic_Sniffer:_Upgrade_mode_protocol)

The bootloader is an HID device, so there is no confusing it for the update mode. You can get the bootloader protocolversion in the bootloader mode, and that is it.

Quote
I think it would be good to define a fixed location in the binary images (firmware and bitstream) to hold a version number or build ID (a 16bit int is probably sufficient). This would allow querying and displaying these in 'update mode' quite easily.

The firmware does hold a version which can be queried and reported (see above). We could fix it to a program memory address, but the only advantage of that would be the ols-loader utility could read the version before programming. Why not just look at the file name?

I don't think there is the concept of a fixed variable location in the FPGA synthesis process. Querying the bitstream version from the PIC is a huge can of worms. I don;t see the advantage of the update mode reporting the existing bitstream version when it is about to be overwritten in 99.99% of cases.

Quote
At least the bitstream version should be available to the (java) client as well.

Ther eis currently no way to query the version from the SUMP Logic analyzer core in the FPGA. None. This is a long wanted feature, but no VHDL developer has ever contributed it. Very recently dogsbody dropped a Verilog replacement that implements this feature. It should be available in the next update.

The PIC could query this in ROM update mode to report the current bitstream version. If you make the modifications I'll happily include them in the next PIC release, but I'd need some motivation to do it myself and I don;t see the need right now.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 02, 2011, 01:14:09 pm
Attached is brand new ols-fwloader. You will have to go through process:

./configure
make
make install (optional)

It supports linux, darwin, mingw, also supports crosscompiling (--host=mingw32). Let me know when you find some configuration error. This is my first try to use autotools.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 02, 2011, 02:29:41 pm
[quote author="ian"]
Quote
Ian, is there a way to obtain the software levels in 'update mode' and from the boot loader ?

Do you mean versions? Or the current mode? In ROM update mode ols-loader can read and report the bootloader, PIC firmware, and hardware version. Note that the bootloader version is OUR bootloader version, not the manufacturer's protocol version that is reported in the bootloader mode. This is also documented on the wiki: http://dangerousprototypes.com/docs/Log ... e_protocol (http://dangerousprototypes.com/docs/Logic_Sniffer:_Upgrade_mode_protocol)

The bootloader is an HID device, so there is no confusing it for the update mode. You can get the bootloader protocolversion in the bootloader mode, and that is it.
[/quote]
So it looks to me like the infrastructure is there, we just need for ols-fwloader to be able to simply query the versions and exit. I've seen that is displays version info when interacting update mode. I've hacked a change to ols-fwloader, a new flag '-i' provides version info:
Code: [Select]
$ ./ols-fwloader -i -P /dev/ttyACM0
Found OLS:  Hardware: 1, Firmware: 2.1, Bootloader: 1
Found flash: ATMEL AT45DB041D
The code can be found on http://https://github.com/markusb/ols-fwloader.git

[quote author="ian"]
Quote
I think it would be good to define a fixed location in the binary images (firmware and bitstream) to hold a version number or build ID (a 16bit int is probably sufficient). This would allow querying and displaying these in 'update mode' quite easily.

The firmware does hold a version which can be queried and reported (see above). We could fix it to a program memory address, but the only advantage of that would be the ols-loader utility could read the version before programming. Why not just look at the file name?[/quote]
Fair enough, file names work fine too.

[quote author="ian"]
Quote
At least the bitstream version should be available to the (java) client as well.

There is currently no way to query the version from the SUMP Logic analyzer core in the FPGA. None. This is a long wanted feature, but no VHDL developer has ever contributed it. Very recently dogsbody dropped a Verilog replacement that implements this feature. It should be available in the next update.

The PIC could query this in ROM update mode to report the current bitstream version. If you make the modifications I'll happily include them in the next PIC release, but I'd need some motivation to do it myself and I don;t see the need right now.[/quote]
I understand. I don't have a PIC toolchain right now, so chances for myself doing something are not good. But it looks like the feature is coming and might be available via Java client.

One last thing, the OLS has three distinct operation modes (nromal, update and bootloader), but two of them look the same (same LED state). Could we change the 'update' mode to be distinct, for example with a flashing 'act' LED ? This should help to reduce confusion about which states it is in.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on February 02, 2011, 03:47:38 pm
Quote
Could we change the 'update' mode to be distinct, for example with a flashing 'act' LED ? This should help to reduce confusion about which states it is in.

Blinking indicates error modes and being stuck in the FPGA load mode. I think it would be confusing to cross error with an actual mode. Ideally the hardware would have more LEDs and buttons to deal with all these things, but that's not how we built it :)
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: jone on February 02, 2011, 04:00:21 pm
[quote author="robots"]Attached is brand new ols-fwloader. You will have to go through process:

./configure
make
make install (optional)[/quote]

Thanks robots,

Can confirm it all builds fine here (32bit Fedora 14). Cosmetically, you seem to be missing a line feed on the printf("This is " PACKAGE_STRING); at the top of main()...

Regards,
Jon
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 02, 2011, 04:55:19 pm
I've checked out the source from git (github). The ./configure script is missing there. It is present in the compressed tar.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 02, 2011, 05:27:19 pm
I know about the linefeed :) thanks anyways.

The configure script is generated automatically by autotools . Try running autoreconf --install.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 02, 2011, 05:35:35 pm
autoreconf --install does not work.
Code: [Select]
$ autoreconf --install
aclocal: couldn't open directory `m4': No such file or directory
autoreconf: aclocal failed with exit status: 1
after creating the 'm4' directory is does work, though (and creates a m4 directory).

./configure display an error about libusb checking:
Code: [Select]
$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
checking for pkg-config... /usr/bin/pkg-config
./configure: line 10766: OLS_CHECK_LIBUSB: command not found
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 02, 2011, 05:39:39 pm
working now.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: markus_b on February 02, 2011, 07:14:21 pm
Yes, it is working now for me too :-).

I like the more explicit messages too. But I guess you don't like my version-display patch as I do.

Thanks  Markus
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: tayken on February 05, 2011, 10:44:38 am
Works like a charm! :)

But one note: I had to use -P option to be able to load the bitstream, you might want to include that in the usage part.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on February 05, 2011, 11:27:14 am
yes. I have noticed that it is missing. sorry. will add soon  :-)

edit: actually it has already been fixed in git.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: triden on August 17, 2011, 12:32:06 am
Just got my OLS today.

I followed the instructions at: http://dangerousprototypes.com/docs/Log ... pplication (http://dangerousprototypes.com/docs/Logic_Sniffer:_Comprehensive_update_application)
in an attempt to update the PIC and FPGA.

Everything I try gives an error:

sudo ./ols_fwloader -f APP -P /dev/ttyACM0 -V -t BIN -w /Downloads/ols-0308/OLS_Upgrader/FPGAROM/logic_sniffer_3.07-Demon-Core.bit
Found OLS HW: 1, FW: 3.0, Boot: 2
Error - unknown flash type (ef 40 14 00)
Is OLS in update mode ??
Unable to read Flash ID
Unable to open OLS

I guess I have the latest PIC firmware, but I am unable to tell what FPGA version is loaded.  I thought I remember reading somewhere that the new boards were shipping with a newer flash chip.

Thanks.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: jone on August 17, 2011, 01:01:27 am
Yes, that id looks like a new Winbond flash chip (google says W25Q80).

Looking at the code, I think it's a simple change to define the new flash type, hopefully robots can confirm for sure.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on August 17, 2011, 07:57:03 am
Hi triden,

Thanks for the report, I'm sorry about the problem.

Here's the list of chips we've used:
http://dangerousprototypes.com/docs/Log ... 1_JEDEC_ID (http://dangerousprototypes.com/docs/Logic_Sniffer:_Upgrade_mode_protocol#0x01_JEDEC_ID)

I am unaware of any other chips used in production. May I please ask where this OLS came from?

I believe there is an override command in the ols-loader application that will ignore flash type. I will also make a new app for you now.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on August 17, 2011, 08:03:14 am
Here's an updated version. Lots of compile warnings, not sure it works.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: jone on August 17, 2011, 01:22:32 pm
Untested, but here's a quick patch for ols_fwloader if you're building from source...

Regards,
Jon
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: triden on August 18, 2011, 07:55:53 pm
[quote author="ian"]Hi triden,
I am unaware of any other chips used in production. May I please ask where this OLS came from?
[/quote]

I purchased my OLS from Gadget Factory.  It shows Logic Sniffer v1.04 on the silkscreen.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: triden on August 18, 2011, 08:09:14 pm
[quote author="jone"]Untested, but here's a quick patch for ols_fwloader if you're building from source...
Regards,
Jon[/quote]

Joh,

Thanks for the fast patch update.  I recompiled and it now appears to work fine.

sudo ./ols_fwloader -f BOOT -n -P /dev/ttyACM0 -V -w Downloads/ols-0308/OLS_Upgrader/PIC_firmware/OLSv1.firmware.v3.0.hex
Found OLS HW: 1, FW: 3.0, Boot: 2
Found flash: WINBOND W25Q80
OLS switched to bootloader mode
Bootloader version 0.2.2
Bootloader version 0.2.2
Checking flash ... (0x0800 - 0x3c00)
Verified OK! :)

sudo ./ols_fwloader -f APP -P /dev/ttyACM0 -V -t BIN -w Downloads/ols-0308/OLS_Upgrader/FPGAROM/logic_sniffer_3.07-Demon-Core.bit
Found OLS HW: 1, FW: 3.0, Boot: 2
Found flash: WINBOND W25Q80
Checking flash ...
.....................
Verify OK

sudo ./ols_fwloader -P /dev/ttyACM0 -f APP -S
Found OLS HW: 1, FW: 3.0, Boot: 2
Found flash: WINBOND W25Q80
done...
Passed self-test :)
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on August 18, 2011, 10:17:31 pm
Thanks. I have added these IDs to the github repository.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on August 19, 2011, 08:52:40 am
Thanks everyone!
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: chautygorcy on April 26, 2012, 08:41:19 am
Since there are two different crystal configurations out there, it is important to protect that region from overwrite.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: robots on April 26, 2012, 08:53:11 am
and you are trying to say?

the tool actually protect you from writing to the Bootloader part(first xx kb), and to the fuse part (last few bytes).
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: jrsub25 on June 18, 2012, 07:45:56 pm
Hello,
I wrote a codeless kext that allows this tool to work under Mac OS X.  It also works for all the other firmware loaders for the Diolan-type bootloaders found on the OLS and IRToy.  I have only tested it on 10.7.4, but it should work on others.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: ian on June 20, 2012, 08:34:33 am
jrsub25,


Thanks for this contribution. Can you please share a little about how it works, I'm not familiar with Mac. I'll add a link to the documentation.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: jrsub25 on June 20, 2012, 06:52:26 pm
Hi Ian,

In operation, a codeless kext is a bit like udev.  When a device in the Diolan bootloader-mode is connected to the Mac, it is matched to the IOUSBHID Driver.  Libusb has no way to unmatch this driver and use the generic IOUSBInterface.  This leads to errors about "Cannot claim USB device."  The DiolanDeviceDriver matches the device with PID, VID, and bcdDevice, giving it the highest probe score, thereby blocking IOUSBHID and using standard IOKit.  The driver has no code in it, simply a plist file.  By matching to VID, PID, and bcdDevice, it only effects the bootloader mode.  There are entries for the OLS and IRToy.

To install:

sudo cp -r {path to the kext}/DiolanDeviceDriver.kext /System/Library/Extensions/

sudo kextutil /System/Library/Extensions/DiolanDeviceDriver.kext

sudo touch /System/Library/Extensions

As a note, those on 32bit systems may have to edit all instances of "com.apple.kpi.iokit" in the plist file to "com.apple.kernel.iokit".  Other devices can also be added to the file.
Title: Re: Brand new OLS (boot)loader tool - Windows and Linux
Post by: Bingo on July 17, 2012, 09:49:05 pm
Just added a stepguide for building the ols updater on Linux (ubuntu 10.04)
http://www.mikrocontroller.net/topic/26 ... 93#2759493 (http://www.mikrocontroller.net/topic/264866?goto=2759493#2759493)

Direct Link : http://www.mikrocontroller.net/attachme ... pguide.txt (http://www.mikrocontroller.net/attachment/149688/ols-stepguide.txt)

Maybe it helps someone , building the ols_loader from github sources.

/Bingo