DISTORTEC / distortos

object-oriented C++ RTOS for microcontrollers
https://distortos.org/
Mozilla Public License 2.0
434 stars 67 forks source link

Added template for STM32 Discovery-F072B board. Upon upload/reset, a… #53

Closed charlesrwest closed 5 years ago

charlesrwest commented 5 years ago

…ll user LEDs turn on and after a few seconds start blinking, so it appears to be working.

FreddieChopin commented 5 years ago

Hello @charlesrwest and thanks for your contribution!

See branch https://github.com/DISTORTEC/distortos/tree/charlesrwest-added_board_yaml

The Travis-CI check failed, because generated board files were not committed along with the YAML file. I've generated them and modified your commit. In the second commit I've also added the test project configuration to the repository, so that this board will be built by Travis-CI on every update. Could you please check whether this configuration still works for you? It should, but I have no way of testing it on real hardware (; I've just enabled options to make it similar to the other test configurations and also configured PLL to use HSE.

Thanks in advance!

FreddieChopin commented 5 years ago

OK, ignore the branch I mentioned, I have pushed to your repository, which seems to be the only way to modify the pull-request. I hope you don't mind, as this is a bit strange that I have to modify your repository...

But still - I would be very grafeful for your confirmation, that the test project configuration that I created is valid. Just do this to check:


$ mkdir output
$ cd output
$ cmake -C ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake .. -GNinja
$ ninja distortosTest
<check whether it works>

(or drop -GNinja to use make)

Again - thanks in advance!

charlesrwest commented 5 years ago

I got: cmake -C ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake .. -GNinja

loading initial cache file ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake CMake Error: Error processing file: ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake CMake Error at CMakeLists.txt:15 (distortosSetConfiguration): Unknown CMake command "distortosSetConfiguration".

-- Configuring incomplete, errors occurred! See also "/home/charlesrwest/cpp/libraries/distortos-fork/build/CMakeFiles/CMakeOutput.log".

On Wed, Feb 27, 2019 at 11:22 AM Freddie Chopin notifications@github.com wrote:

OK, ignore the branch I mentioned, I have pushed to your repository, which seems to be the only way to modify the pull-request. I hope you don't mind, as this is a bit strange that I have to modify your repository...

But still - I would be very grafeful for your confirmation, that the test project configuration that I created is valid. Just do this to check:

$ mkdir output $ cd output $ cmake -C ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake .. -GNinja $ ninja distortosTest

(or drop -GNinja to use make) Again - thanks in advance! — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .
FreddieChopin commented 5 years ago

Hmm... CMake has the strangest error messages, but I think that the problem here is that you did not update your branch after my forced push and that you actually don't have the configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake file in your tree. This would be the CMake Error: Error processing file: ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake error message - as if CMake couldn't just say that no such file was found...

Please try the commands taken from here https://stackoverflow.com/questions/9813816/git-pull-after-forced-update :

$ git fetch
$ git reset origin/added_board_yaml --hard

Then try the commands I posted. Please make sure that you use them from exactly one folder below distortos main tree (for example distortos-fork/build/ as you tried previously, but not distortos-fork/build/something-else/).

FreddieChopin commented 5 years ago

Hey @charlesrwest - did you manage to get this working? Thanks in advance for the info!

charlesrwest commented 5 years ago

I have not. Also, my original previously working version is no longer working. I am confused. Apologies.

On Thu, Feb 28, 2019 at 3:38 PM Freddie Chopin notifications@github.com wrote:

Hey @charlesrwest https://github.com/charlesrwest - did you manage to get this working? Thanks in advance for the info!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DISTORTEC/distortos/pull/53#issuecomment-468429208, or mute the thread https://github.com/notifications/unsubscribe-auth/AG7-8JWnUjCVdbXVbagSuSScF9k7KUiDks5vSD5FgaJpZM4bU1Ix .

FreddieChopin commented 5 years ago

Hmm... Strange indeed... I need some more info to help you, for example whether the commands don't work (which one exactly?) or is the compiled binary not working correctly? Did you manage to update (reset) your repo to the latest changes? What does git status say?

Also, my original previously working version is no longer working. I am confused. Apologies.

You can always go back to your version by resetting your git tree to the original git hash. You can find this git hash with git reflog. But I guess this is not the real problem here - I think there are just some conflicts in your git tree, so running git status would really help to narrow it down.

Sorry for causing so much trouble with my update of your branch /;

FreddieChopin commented 5 years ago

If you are not an git expert (I'm not, git is really confusing [; ), you can just clone your repo from github again to a new location, checkout the added_board_yaml branch and check the configuration from there. It's sometimes easier to start from scratch instead of trying to get git to some proper state - obviously only if you don't have any more local changes that you would like to keep (like other branches, stashes and uncommited work).

FreddieChopin commented 5 years ago

I've rebased this pull-request, added two more commits (README.md file for the board and entry in CHANGELOG.md) and merged it to master.

The test project configuration is not tested, but I assume it works.

As for your issue, I think I know what the problem was. CMake can be a bit puzzling at times (well... most of the time [; ). If you initialize a CMake build directory once (with cmake -C ... or just cmake .. -DCMAKE_TOOLCHAIN_FILE=... or even using cmake-gui) then you cannot SIGNIFICANTLY change the configuration of this initialized build folder, because this will fail in mysterious ways either instantly or later (during the build). So here is a scenario which I think happened in your case:

$ mkdir output
$ cd output
$ cmake -C ../this/file/does/not/exist.cmake .. -GNinja
loading initial cache file ../this/file/does/not/exist.cmake
CMake Error: Error processing file: ../this/file/does/not/exist.cmake
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:15 (distortosSetConfiguration):
  Unknown CMake command "distortosSetConfiguration".

-- Configuring incomplete, errors occurred!
See also "/home/freddie/Elektronika/ARM/Projects/distortos/output/CMakeFiles/CMakeOutput.log".
$ cmake -C ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake .. -GNinja
loading initial cache file ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake
CMake Error at CMakeLists.txt:15 (distortosSetConfiguration):
  Unknown CMake command "distortosSetConfiguration".

-- Configuring incomplete, errors occurred!
See also "/home/freddie/Elektronika/ARM/Projects/distortos/output/CMakeFiles/CMakeOutput.log".
$ 

If a CMake build folder initialization fails, there is only one thing you can (and should!) do with it - delete it completely. Any attempt to recover it to a valid state is doomed to fail.

Here is what you should do about the situation above:

$ mkdir output
$ cd output
$ cmake -C ../this/file/does/not/exist.cmake .. -GNinja
loading initial cache file ../this/file/does/not/exist.cmake
CMake Error: Error processing file: ../this/file/does/not/exist.cmake
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:15 (distortosSetConfiguration):
  Unknown CMake command "distortosSetConfiguration".

-- Configuring incomplete, errors occurred!
See also "/home/freddie/Elektronika/ARM/Projects/distortos/output/CMakeFiles/CMakeOutput.log".
$ cd ..
$ rm -rf output
$ mkdir output
$ cd output
$ cmake -C ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake .. -GNinja
loading initial cache file ../configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake
-- Removing "-DNDEBUG" from CMAKE_{C,CXX}_FLAGS_{MINSIZEREL,RELEASE,RELWITHDEBINFO}.
-- Assertions are now configured with distortos_Checks_..._Asserts option.
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /home/freddie/arm-none-eabi-gcc-8.3.0-190223/bin/arm-none-eabi-gcc
-- Check for working C compiler: /home/freddie/arm-none-eabi-gcc-8.3.0-190223/bin/arm-none-eabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/freddie/arm-none-eabi-gcc-8.3.0-190223/bin/arm-none-eabi-g++
-- Check for working CXX compiler: /home/freddie/arm-none-eabi-gcc-8.3.0-190223/bin/arm-none-eabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Updated configuration from version 0 to 1
-- Generating /home/freddie/Elektronika/ARM/Projects/distortos/output/include/distortos/distortosConfiguration.h
-- Generating /home/freddie/Elektronika/ARM/Projects/distortos/output/distortosConfiguration.cmake
-- Generating /home/freddie/Elektronika/ARM/Projects/distortos/output/ST_32F072BDISCOVERY.preprocessed.ld
-- Configuring done
-- Generating done
-- Build files have been written to: /home/freddie/Elektronika/ARM/Projects/distortos/output
$ ninja distortosTest
[171/171] Linking CXX executable test/distortosTest.elf
   text    data     bss     dec     hex filename
 120784    1260    6664  128708   1f6c4 /home/freddie/Elektronika/ARM/Projects/distortos/output/test/distortosTest.elf
$ 

Initially your CMake initialization failed, because you did not update your branch with the changes I have made, so you actually did not have the configurations/ST_32F072BDISCOVERY/test/distortosConfiguration.cmake file. Then you probably tried to recover with the same folder, without deleting it first, which kept failing.

If possible, I would still be grateful for a confirmation that the test configuration actually works fine - after ~15 seconds the LEDs should start blinking slowly (about 1 Hz), which confirms that the test finished successfully. If they blink fast (about 10 Hz), the test completed with a failure. If they are constantly on even after ~15 seconds have passed, then the test most likely caused a hard fault, assertion failure or some other fatal error.