STM32F745xx debugging help

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

fvantienen
Posts: 20
Joined: Thu Nov 08, 2018 11:56 am
Has thanked: 1 time
Been thanked: 2 times

STM32F745xx debugging help

Postby fvantienen » Thu Nov 08, 2018 12:05 pm

I am new to ChibiOS and could use some debugging help for my new STM32F745VEH6 board. I have some simple functions running, but as soon as I am using any USART, the board immediately crashes while trying to transmit a single character.

The problem occurs inside oq_write at line

Code: Select all

memcpy((void *)oqp->q_wrptr, (const void *)bp, n)
, where immediately after the call of memcpy it crashes.

The GDB output is printed below:

Code: Select all

(gdb) s
123       memcpy((void *)oqp->q_wrptr, (const void *)bp, n);
(gdb) print (void*)oqp->q_wrptr
$4 = (void *) 0x20002c58 <sd_out_buf2>
(gdb) p (const void *)bp
$5 = (const void *) 0x20003a4b <wa_thd_uart2_tx+499>
(gdb) p n
$6 = 1
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x00206924 in ?? ()


I am currently out of ideas on how this could happen and how to further debug this, since a normal memcpy somewhere else does not give any problem at all. Could maybe someone give some advise on how to tackle this problem?

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32F745xx debugging help

Postby Giovanni » Thu Nov 08, 2018 4:02 pm

Have you verified that pointers passed to memcpy are valid? those could be corrupted.

Giovanni

rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

Re: STM32F745xx debugging help

Postby rew » Sun Nov 18, 2018 8:22 pm

I can answer that question for him. Yes he has. One points to a symbol sd_out_buf2 and the other in a thread working area. Both are in normal SRAM and below 16kbyte from the start, probably the CPU has a lot more memory.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32F745xx debugging help

Postby Giovanni » Sun Nov 18, 2018 9:16 pm

I see nothing there, probably the best approach is to single step into memcpy and see how/where it fails.

Giovanni

rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

Re: STM32F745xx debugging help

Postby rew » Mon Nov 26, 2018 10:23 am

Giovanni,
When I compile a project with chibios, it pulls stuff like "memcpy" in from a library on my system somewhere, right? That's called "newlib" correct?

Is there a recommended version? It seems all chibios CDC projects compiled on Ubuntu 18.04 fail somehow due to the installed newlib version.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32F745xx debugging help

Postby Giovanni » Mon Nov 26, 2018 10:54 am

Hi,

Are you using the GCC compiler from ARM? any version should be fine.

Compilers pulled from distro repositories are known to be broken.

Giovanni

rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

Re: STM32F745xx debugging help

Postby rew » Sat Dec 08, 2018 10:09 am

I was using some special compiler (lots of trouble to install) before 2016. In 2016 I was relieved that suddenly the distro compiler simply worked. So 2018 I need to go back to the "lots of trouble to install an non-distro compiler"?

Anyway, I've narrowed it down to the linking phase. I can compile just fine on 18.04, then copy the object files over to 16.04 and the link them. That works. All object files compiled under 16.04 and then linked under 18.04 fail.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32F745xx debugging help

Postby Giovanni » Sat Dec 08, 2018 10:19 am

Hi,

It happened a several times that distro-provided compilers created problems, I recommend the one maintained by ARM: https://launchpad.net/gcc-arm-embedded

There are packages for all OSes.

Giovanni

rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

Re: STM32F745xx debugging help

Postby rew » Sat Dec 08, 2018 12:42 pm

So now what? I Have ubunut 18.04? This looks unmaintained to me if there hasn't been a release/update in two years. How do I see the difference between "abandoned for two years" and this?

Ah! I'm supposed to use the PPA.
PPA location remains unchanged.

I suppose you know the location of the PPA I'm supposed to use?

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32F745xx debugging help

Postby Giovanni » Sat Dec 08, 2018 12:49 pm

There is a download from the ARM web site: https://developer.arm.com/open-source/g ... /downloads

It is not a PPA, download and unpack it your user directory then add paths.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 45 guests