Not sure if here is the best place to ask this or if I should ask this as an github issue or…
But thought I would start off here as I posted some information on how I do this with the OpenCR board as described in:
https://community.robotsource.org/t/opencr-how-to-use-current-stuff-develop-branch/1412
But whenever possible I try to help out some, so if I run into an issue, I like to try to fix it and then try to help out by doing a pull request back to the original sources… I have found with the OpenCM 9.04 it is a little more complicated on how to build the current sources, which are not part of the github MASTER branch, but are instead part of the DEVELOP branch.
Note: I have forked the Robotis OpenCM project and then I have cloned my fork down to my Windows 10 machine to:D:\GitHub\OpenCM9.04
The complications here is, with the normal builds, the source files are not included as part of the release, instead, there is a pre-compiled library.
Like the OPenCR I have my configuration setup, to be able to build using the current released stuff (installed using the Arduino Board manager)
How I setup to then build using the develop branch. Note I am running this on Windows 10, but I am pretty sure you can do almost identical using Linux and probably MAC.
So I create a directory under my Arduino documents folder. On my installation, the actual directory name is:C:\Users\kurte\Documents\Arduino\hardware\opencm904
Note the name opencm904 including case is important as this is used by Arduino for board type…
In this new directory I created a symbolic link: again names including case is important, but I believe the actual command was:
mklink /D opencm9.04 D:\GitHub\OpenCM9.04\arduino\opencm_arduino\opencm9.04
Then after you restart the Arduino IDE, the OpenCM9.04 board will show up twice in the Tools->Board menu
I like to edit the boards.txt file to change the name. Something like:
OpenCM904.name=OpenCM9.04 Board
OpenCM904.name=OpenCM9.04 Board(develop)
Now I am ready to start building with the new sources, Here is where I start running into issues and would like to know the way Robotis does it?
The compiling of the sources usually works, however, the link will fail. Either because it can not find the precompiled core library, or if it does, you will get duplicate name errors as it is trying to include both the new and the old…
What I did was to edit platform.txt and edit the recipe.c.combine.pattern to remove: “{build.variant.path}/{build.variant_system_lib}”
This works for me and the build goes through. Note however I am getting a compiler warning on every compile line. Note: I have verbose compiles turned on.
"C:\Users\kurte\AppData\Local\Arduino15\packages\OpenCM904\tools\opencm_gcc\5.4.0-2016q2/bin/arm-none-eabi-gcc" -c -g -O2 -std=gnu11 -MMD -ffunction-sections -fdata-sections -DARM_MATH_CM3 -DUSE_HAL_DRIVER -DBOARD_OpenCM904 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10805 -DARDUINO_OpenCM904 -DARDUINO_ARCH_OPENCM9.04 -mthumb -DSTM32F103xB -D__OPENCM904__ "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/bsp/opencm" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/bsp/opencm/include" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/hw" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/hw/driver" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/hw/usb_cdc" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/lib/STM32F1xx_HAL_Driver/Inc/" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\cores\arduino" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904" "C:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\cores\arduino\wiring_shift.c" -o "C:\Users\kurte\AppData\Local\Temp\arduino_build_442706\core\wiring_shift.c.o"
<command-line>:0:21: warning: ISO C99 requires whitespace after the macro name
"C:\Users\kurte\AppData\Local\Arduino15\packages\OpenCM904\tools\opencm_gcc\5.4.0-2016q2/bin/arm-none-eabi-gcc" -c -g -O2 -std=gnu11 -MMD -ffunction-sections -fdata-sections -DARM_MATH_CM3 -DUSE_HAL_DRIVER -DBOARD_OpenCM904 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10805 -DARDUINO_OpenCM904 -DARDUINO_ARCH_OPENCM9.04 -mthumb -DSTM32F103xB -D__OPENCM904__ "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/bsp/opencm" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/bsp/opencm/include" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/hw" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/hw/driver" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/hw/usb_cdc" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/lib/STM32F1xx_HAL_Driver/Inc/" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904/" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\cores\arduino" "-IC:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\variants\OpenCM904" "C:\Users\kurte\Documents\Arduino\hardware\opencm904\opencm9.04\cores\arduino\avr\dtostrf.c" -o "C:\Users\kurte\AppData\Local\Temp\arduino_build_442706\core\avr\dtostrf.c.o"
<command-line>:0:21: warning: ISO C99 requires whitespace after the macro name
...
So recently I did a minor Pull Request to OpenCM, which was accepted However it appears like, to do it fully properly, you need some additional stuff done, which I believe maybe includes:
Copy any new/updated header files to release directory, so in my case the files need to be updated in:
D:\GitHub\OpenCM9.04\arduino\opencm_arduino\opencm9.04_release\cores\arduino
And for any changed library do you also update the sources in the release folder as well?
In particular:
D:\GitHub\OpenCM9.04\arduino\opencm_arduino\opencm9.04_release\variants\OpenCM904\lib_f103.a
Is this a copy of the core.a that Arduino created in the temp directory. In my latest case the file:
C:\Users\kurte\AppData\Local\Temp\arduino_build_442706\core\core.a
Again I am able to build using the current stuff, but would be great if I was doing it in way that was consistent in how it is done at Robotis.
Thanks,
Kurt