Oh no, I bricked my DSO

both of them :frowning: After turning on, the screen turns white, no beep. Cannot enter DFU, holding any button while turning on doesn’t change anything. When plugged to USB, windows says “USB device not recognized”

It has probably something in common with this linker script:

/* Define memory regions. */
MEMORY
{
  RAM (rwx) : ORIGIN = 0x20003000, LENGTH = 34K
  ROM (rx) : ORIGIN = 0x804C000, LENGTH = 200K
  ENTRY (rx) : ORIGIN = 0x0800C000, LENGTH = 32K
  BIOSRAM (rwx) : ORIGIN = 0x20001000, LENGTH = 3K
  COOKIES (rwx) : ORIGIN = 0x20000800, LENGTH = 1K
}

/*
	// 0x20000000 .. 0x20000574  BIOS      (1396 bytes)
	// 0x20000800 .. 0x20000C00  COOKIES   (1k)
	// 0x20000C00 .. 0x20001800  GBIOS     (3k)
	// 0x20001800 .. 0x20002000  JPA       (2k)
	// 0x20002000 .. 0x20003000            (4k)
	// 0x20003000 .. 0x2000B800  APP RAM   (34k)
	// 0x2000B800 .. 0x2000C000  STACK     (2k)
*/
INCLUDE ../Source/HwLayer/ArmM3/lds/main.lds

What tool do I need to restore the DFU??

Update: The linker script is innocent in this (I reorganized only the RAM parts), then I realized I built the firmware with custom built ARM toolchain… gosh! Can anybody point me to a suitable programmer for STM32?

You only need the serial port and an USB to serial converter. (Or you might even try bluetooth :smiley:)

Tie BOOT0 (on the 6-pin header) to Vdd, turn on the device and use this script:

code.google.com/p/stm32flash/

You can try these images. I don’t know if there is still that license check crap that you might run into:
kapsi.fi/~jpa/stuff/other/my-original-flash.bin
kapsi.fi/~jpa/stuff/other/dso_qu … _flash.bin
kapsi.fi/~jpa/stuff/other/dso_qu … dified.bin

Seems I am in deeper trouble, tried the stm32flash utility and it stops working after flashing address 0x08000700 (0.68%). Dumping whole flash into file works fine, it generates 512kB file with 0x708 meaningful bytes and the remaining of the file is filled with 0xff. Bad bad bad… Anyway, I have HEX image that will reliably brick the DSO if anyone would be interested…

Update: both of the DSO’s (v6 & v7) behave the same way, it flashes only the first 0.68% of memory and then it stops

Maybe you have managed to write protect the flash? Try the -u option.

Also you can try this other program:
github.com/jsnyder/stm32loader

AAhh, the stm32flash utility is made primarily for linux OS but I have found some win32 build with buggy file access routines and this caused the utility to freeze

changing the code to this solved the problem:

parser_err_t binary_read(void *storage, unsigned char *data, unsigned int *len) {
	binary_t *st = (binary_t *)storage;
	unsigned int left = *len;
	if (st->write) return PARSER_ERR_WRONLY;

	int r;
	while(left > 0) {
		r = fread(data, 1, 1, st->fd);
		if (r < 0) return PARSER_ERR_SYSTEM;
		left -= r;
		data += r;
	}

	*len = *len - left;
	return PARSER_ERR_OK;
}

Thank you very much JPA again, now my device boots, but it is requesting some license (tried all of your flash images), WTF is this? I am getting more and more convinced I want get rid of the original BIOS/DFU code and replace it with some more reliable bootloader.

Some info about it here:
viewtopic.php?f=26&t=2519&p=9337

For a replacement bootloader, the stuff used in black magic probe could be ok. BUT: you need some way to load FPGA image also…