Running cpp code on NUCLEO144 STM32F767ZI using ChibiOS 19

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

Moderators: RoccoMarco, barthess

jmajew
Posts: 3
Joined: Mon Feb 24, 2020 11:54 am
Been thanked: 1 time

Running cpp code on NUCLEO144 STM32F767ZI using ChibiOS 19

Postby jmajew » Mon Feb 24, 2020 1:06 pm

Hello,

I am trying to port a piece of cpp code from ChibiOS18.2.1 to 19.1.3 using NUCLEO144 STM32F767ZI and run into problems. After spending a whole day trying different approaches I have narrow down problem to a simple blinker code where a blinker thread class is defined and then is started inside the main function.

I have created two projects: for ver.18 and ver.19 (both attached). The main.cpp is the same in both of them and configuration files are taken from demos/STM32/RT-STM32F767ZI-NUCLEO144. Makefiles differs only to respect differences in building process between two versions of OS. The version for 18 works as expected while for 19 hangs during initialization. I tried another board, Discovery F407, and there was no problem. I have used gcc 6.3.1 but also tried the recent 9.2.1 with no positive effects.

I had also problem during linking of ver. 19 which was related to missing _exit, _kill and _getpid. Adding __attribute__((used)) in the definition of the functions inside syscalls_cpp.cpp fixed the problem. The ver. 18 didn't needed such action.

At this moment I have run out of options (appart from sticking to version 18.2.1) and I would really appreciate any hint what I could try to do.

Thanks in advance,
Jurek
Attachments
blink_19.zip
(13.59 KiB) Downloaded 150 times
blink_18.zip
(13.28 KiB) Downloaded 147 times

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

Re: Running cpp code on NUCLEO144 STM32F767ZI using ChibiOS 19

Postby Giovanni » Mon Feb 24, 2020 1:18 pm

Hi,

I will give it a try.

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: Running cpp code on NUCLEO144 STM32F767ZI using ChibiOS 19

Postby steved » Mon Feb 24, 2020 2:46 pm

Are you using the 'distribution zip' of 19.1.3? If so, update at least \os\common\startup\ARMCMx\compilers\GCC\ld\rules_code.ld from SVN; there's a fix to a problem linking with static objects.

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

Re: Running cpp code on NUCLEO144 STM32F767ZI using ChibiOS 19

Postby Giovanni » Mon Feb 24, 2020 2:51 pm

Thanks steved, this is the file to replace:

rules_code.ld.7z
(906 Bytes) Downloaded 155 times


Giovanni

jmajew
Posts: 3
Joined: Mon Feb 24, 2020 11:54 am
Been thanked: 1 time

Re: Running cpp code on NUCLEO144 STM32F767ZI using ChibiOS 19

Postby jmajew » Mon Feb 24, 2020 4:42 pm

Thanks a lot for your fast help! Now it works as expected.
I was using distribution version of 19.1.3 but I better switch to the branch 19.1.x from current repo.
Best regards,
Jurek

P.S. Giovanni, in your rules_code.ld.7z you posted, the variables names are incompatible with the rest of the os, e.g., it is __init_array_base__ vs __init_array_start as I think it should be, and etc, but after correcting this everything goes as expected. Thanks again!

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

Re: Running cpp code on NUCLEO144 STM32F767ZI using ChibiOS 19

Postby Giovanni » Mon Feb 24, 2020 5:14 pm

Yes, some names changed for consistency in the newest version, you did the right thing.

BTW, you could switch to latest code safely, it is stable and will be released soon as version 20.x.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 41 guests