arduino, gdb, st-link and classic'ish blink

Post Reply
zmemw16
Posts: 1484
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

arduino, gdb, st-link and classic'ish blink

Post by zmemw16 » Fri Aug 14, 2015 12:53 am

i suppose i'm trying to get to a stm32f103 capable debugging environment and i'm trying to follow this
http://fab.cba.mit.edu/classes/4.140/tu ... stm32.html

any ideas about the memory access messages??? gdb->Cannot access memory at address 0xab77de86
ditto message from st-util

so its one of these http://www.ebay.co.uk/itm/291305557264? ... EBIDX%3AIT

"STM32F103ZET6 Minimum System Development Board ARM STM32 Cortex-m3 M75"
m75.png
m75.png (121.74 KiB) Viewed 1398 times
it's got 24c08 + 25x40BVNiG + rtc crystal = rtc in-built??
24c08 addressing
Density Access Area Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
4K EEPROM 1 0 1 0 A2 A1 P0 R/W
8K EEPROM 1 0 1 0 A2 P1 P0 R/W

25x40B is a (4M-bit) Serial Flash

size wise its the same length as a blue pill and close to twice the width.

Code: Select all

#define LED PG15
#define ON  150
#define OFF 600

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED as an output.
  pinMode(LED, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(OFF);              // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(ON);              // wait for a second
}
assorted cut & pastes

Code: Select all

stephen@i7:~$ st-util 
2015-08-14T01:02:54 INFO src/stlink-common.c: Loading device parameters....
2015-08-14T01:02:54 INFO src/stlink-common.c: Device connected is: F1 High-density device, id 0x10036414
2015-08-14T01:02:54 INFO src/stlink-common.c: SRAM size: 0x10000 bytes (64 KiB), Flash: 0x80000 bytes (512 KiB) in pages of 2048 bytes
2015-08-14T01:02:54 INFO gdbserver/gdb-server.c: Chip ID is 00000414, Core ID is  1ba01477.
2015-08-14T01:02:54 INFO gdbserver/gdb-server.c: Target voltage is 3279 mV.
bind: Address already in use

so i killed off st-link, unplugged and reconnected both the board usb and the st-link

stephen@i7:~$ st-util 
2015-08-14T01:04:53 INFO src/stlink-common.c: Loading device parameters....
2015-08-14T01:04:53 INFO src/stlink-common.c: Device connected is: F1 High-density device, id 0x10036414
2015-08-14T01:04:53 INFO src/stlink-common.c: SRAM size: 0x10000 bytes (64 KiB), Flash: 0x80000 bytes (512 KiB) in pages of 2048 bytes
2015-08-14T01:04:53 INFO gdbserver/gdb-server.c: Chip ID is 00000414, Core ID is  1ba01477.
2015-08-14T01:04:53 INFO gdbserver/gdb-server.c: Target voltage is 3278 mV.
2015-08-14T01:04:53 INFO gdbserver/gdb-server.c: Listening at *:4242...

stephen@i7:~$ arm-none-eabi-gdb-py  <- hoping it was a gui - nope

GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

(gdb) tar extended-remote :4242
Remote debugging using :4242
Cannot access memory at address 0xab77de86
0x080001b0 in ?? ()

st-util gives out
2015-08-14T01:07:21 INFO gdbserver/gdb-server.c: GDB connected.

(gdb) load /tmp/build4424122715320508308.tmp/myBlink.cpp.elf 
Loading section .text, size 0x2a08 lma 0x8000000
Loading section .ARM.exidx, size 0x8 lma 0x8002a08
Loading section .data, size 0xf40 lma 0x8002a10
Loading section .rodata, size 0x164 lma 0x8003950
Start address 0x80001b0, load size 15028
Transfer rate: 9 KB/sec, 3757 bytes/write.
Cannot access memory at address 0xab77de86

stephen

User avatar
RogerClark
Posts: 7437
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: arduino, gdb, st-link and classic'ish blink

Post by RogerClark » Fri Aug 14, 2015 12:58 am

I have that board and last time I tried uploading a sketch I didn't get any errors.

any ideas about the memory access messages??? gdb->Cannot access memory at address 0xab77de86
ditto message from st-util
That address is far outside of the RAM address range. RAM starts at 0x200000 and flash starts at 0x800000

Are you saying, you can't even compile a blink sketch without GDB showing errors.

Did you modify any files. e.g. if you changed the linker files you could easily get an error like that.

zmemw16
Posts: 1484
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: arduino, gdb, st-link and classic'ish blink

Post by zmemw16 » Fri Aug 14, 2015 1:24 am

stock install of arduino and arduino_stm32, not your absolute latest though 2-3days back

sketch runs on the board, blinks a treat, i;ve added compile and upload messages to the end

that blew the 60000 chars limit by 67000
let me know and i'll split them.

i was looking for the 'arduino arm tools' hence why i'm in ./.arduino15
stephen@i7:~/.arduino15$ which arm-none-eabi-gdb
/opt/gcc-arm-none-eabi/bin//arm-none-eabi-gdb
stephen@i7:~/.arduino15$ which arm-none-eabi-gcc
/opt/gcc-arm-none-eabi/bin//arm-none-eabi-gcc

stephen@i7:~/.arduino15$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288]

stephen@i7:~/.arduino15$ arm-none-eabi-gdb --version
GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
Copyright (C) 2014 Free Software Foundation, Inc.

not sure quite where/how they came from!

User avatar
RogerClark
Posts: 7437
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: arduino, gdb, st-link and classic'ish blink

Post by RogerClark » Fri Aug 14, 2015 1:27 am

stephen@i7:~/.arduino15$ arm-none-eabi-gdb --version
GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
Copyright (C) 2014 Free Software Foundation, Inc.

not sure quite where/how they came from!
Since about Arduino 1.6.4 the IDE been hiding files all over the place :-(

User avatar
martinayotte
Posts: 1229
Joined: Mon Apr 27, 2015 1:45 pm

Re: arduino, gdb, st-link and classic'ish blink

Post by martinayotte » Fri Aug 14, 2015 2:31 am

zmemw16 wrote: i was looking for the 'arduino arm tools' hence why i'm in ./.arduino15
stephen@i7:~/.arduino15$ which arm-none-eabi-gdb
/opt/gcc-arm-none-eabi/bin//arm-none-eabi-gdb
"which" command don't care about PWD, it is simply check in your PATH, and here it is finding it under /opt/gcc-arm-none-eabi/bin//arm-none-eabi-gdb, which I don't think it is the version installed by ArduinoIDE.
But even then, that doesn't mean this version is not good too ...
Maybe the problem you're facing is coming from elsewhere ...
Last edited by martinayotte on Fri Aug 14, 2015 3:14 pm, edited 1 time in total.

zmemw16
Posts: 1484
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: arduino, gdb, st-link and classic'ish blink

Post by zmemw16 » Fri Aug 14, 2015 11:36 am

arghhh... 3rd time, i've been timed out yet again when posting, any chance of automatically timed draft saving

no blue led after the load in gdb, beautifully blinking blue led after the continue
and again its
Cannot access memory at address 0xab77de8c
snippets from gdb and st-util semi-ordered

Code: Select all

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
  
  Modified by Roger Clark. www.rogerclark.net for Maple mini 25th April 2015 , where the LED is on PB1
  
 */
 /* slightly adapted by me */
#define LED PG15
#define ON  150
#define OFF 600

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(OFF);              // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(ON);              // wait for a second
}
so did some checking and tidying, too many routes being taken, eclipse, eclipse-arduino, openocd and cdt
looked at the build messages and get these
stephen@i7:~/ard165$ /home/stephen/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.3 20140228 (release) [ARM/embedded-4_8-branch revision 208322]
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

stephen@i7:~/ard165$ /home/stephen/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-gdb
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140228-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
stephen@i7:~/ard165$ st-util
2015-08-14T09:46:15 INFO src/stlink-common.c: Loading device parameters....
2015-08-14T09:46:15 INFO src/stlink-common.c: Device connected is: F1 High-density device, id 0x10036414
2015-08-14T09:46:15 INFO src/stlink-common.c: SRAM size: 0x10000 bytes (64 KiB), Flash: 0x80000 bytes (512 KiB) in pages of 2048 bytes
2015-08-14T09:46:15 INFO gdbserver/gdb-server.c: Chip ID is 00000414, Core ID is 1ba01477.
2015-08-14T09:46:15 INFO gdbserver/gdb-server.c: Target voltage is 3274 mV.
2015-08-14T09:46:15 INFO gdbserver/gdb-server.c: Listening at *:4242...
2015-08-14T10:47:54 INFO gdbserver/gdb-server.c: GDB connected.
2015-08-14T10:49:31 INFO src/stlink-common.c: Attempting to write 2048 (0x800) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2015-08-14T10:49:31 INFO src/stlink-common.c: Finished erasing 1 pages of 2048 (0x800) bytes
2015-08-14T10:49:31 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-08-14T10:49:31 INFO src/stlink-common.c: Successfully loaded flash loader in sram

2015-08-14T10:49:32 INFO src/stlink-common.c: Starting verification of write complete
2015-08-14T10:49:32 INFO src/stlink-common.c: Flash written and verified! jolly good!
2015-08-14T10:49:32 INFO src/stlink-common.c: Attempting to write 2048 (0x800) bytes to stm32 address: 134219776 (0x8000800)
stephen@i7:~/ard165$ /home/stephen/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.3 20140228 (release) [ARM/embedded-4_8-branch revision 208322]
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(gdb) tar extended-remote :4242
Remote debugging using :4242
0x080001b0 in ?? ()
(gdb) load /tmp/build1081544001961835781.tmp/myBlink.cpp.elf
Loading section .text, size 0x2a08 lma 0x8000000
Loading section .ARM.exidx, size 0x8 lma 0x8002a08
Loading section .data, size 0xf40 lma 0x8002a10
Loading section .rodata, size 0x164 lma 0x8003950
Start address 0x80001b0, load size 15028
Transfer rate: 9 KB/sec, 3757 bytes/write.
(gdb)
Flash page at addr: 0x08003800 erased
2015-08-14T12:22:29 INFO src/stlink-common.c: Finished erasing 1 pages of 2048 (0x800) bytes
2015-08-14T12:22:29 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-08-14T12:22:29 INFO src/stlink-common.c: Successfully loaded flash loader in sram

2015-08-14T12:22:29 INFO src/stlink-common.c: Starting verification of write complete
2015-08-14T12:22:29 INFO src/stlink-common.c: Flash written and verified! jolly good!
..
..
..
2015-08-14T12:21:51 INFO gdbserver/gdb-server.c: GDB connected.
2015-08-14T12:22:28 INFO src/stlink-common.c: Attempting to write 2048 (0x800) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2015-08-14T12:22:28 INFO src/stlink-common.c: Finished erasing 1 pages of 2048 (0x800) bytes
2015-08-14T12:22:28 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-08-14T12:22:28 INFO src/stlink-common.c: Successfully loaded flash loader in sram

2015-08-14T12:22:28 INFO src/stlink-common.c: Starting verification of write complete
2015-08-14T12:22:28 INFO src/stlink-common.c: Flash written and verified! jolly good!
2015-08-14T12:22:28 INFO src/stlink-common.c: Attempting to write 2048 (0x800) bytes to stm32 address: 134219776 (0x8000800)
Flash page at addr: 0x08000800 erased
(gdb) continue
Continuing.
Cannot access memory at address 0xab77de8c

Post Reply