AdaCore / Ada_Drivers_Library

Ada source code and complete sample GNAT projects for selected bare-board platforms supported by GNAT.
BSD 3-Clause "New" or "Revised" License
241 stars 142 forks source link

Project wizard: don't optimize semihosting.adb #352

Closed simonjwright closed 4 years ago

simonjwright commented 4 years ago

This problem didn’t show up with GNAT CE 2019, but it does with FSF GCC 9.1.0 & 10.1.0: the output of semihosting is garbled if semihosting.adb is compiled with -O3, OK if compiled with -O0.

What should have been

One_Wire.Get_Info:
  13  46  71  31  0  0  0  135
Flow & ToF both initialized
Flow_Sensor_Task started
ToF_Sensor_Task started

came out as

??

P?
?? 

q

Setup: GDB 8.3 & 9.1 rsp, SEGGER J-Link Edu, SEGGER J-Link GDB Server V6.42 Command Line Version, macOS Catalina

Fabien-Chouteau commented 4 years ago

Hi @simonjwright ,

Do you know what is optimized exactly?

It would be best to fix this in the source code rather than the project file. You change will break builds for RISC-V which doesn't have semihosting.adb.

simonjwright commented 4 years ago

Point taken.

Commit cf3d488 works for me. I did look at the ASM but I really didn’t know what to look for; guessed that forcing copying byte-by-byte might do the trick.

The title of this pull request is now OBE; and it includes a commit that you wouldn’t want. Assuming you’re OK with the change, how should I proceed?

Fabien-Chouteau commented 4 years ago

Thanks @simonjwright , the last patch looks good.

You can add a revert commit on this PR for e7884d5 or start from a new PR.

Either way please rebase on master since I just merged a change in the continuous integration scripts.

simonjwright commented 4 years ago

You change will break builds for RISC-V which doesn't have semihosting.adb.

I don’t believe this is true. This GPR from my Cortex GNAT RTS specifies Switches for at least 3 files that aren’t present in that RTS.

simonjwright commented 4 years ago

Closed in favour of #353