Creating local build environment (core-firmware, core-common-lib, core-communication-lib)

If one were to create a local copy of the Spark firmware, what commands would they use to make sure they had the version of firmware that was also on the compile servers?

I’m not a GIT expert and already have a local directory that is a clone from the master on github.com/spark. However I don’t know the correct command to make my local copy the same as the one on the compile server.

Should I just delete my local copy? If so then what would be the git command to fetch a version that was tagged to match the compile server v0.3.4 Oct 21?

1 Like

@mtnscott, I would encourage you to start using the HAL branch of the firmware since that will be the way forward with the Core and Photon. However, if you want to duplicate the compile server environment locally, you can clone (in a new directory) that branch using:

git clone -b compile-server2 https://github.com/spark/firmware

for the HAL, it would be:

git clone -b feature/hal https://github.com/spark/firmware

:smile:

3 Likes

@peekay123 Thanks for the quick reply. This worked like a champ! Now what if I already had the local ‘cloned’ repositories and just wanted to update them to a different branch, what would the command be ?

For example I have the following directory structure -

Spark/core-firmware
Spark/core-common-lib
Spark/core-communication-lib

they were created using git clone -b compile-server2 https://github.com/spark/firmware core-firmware

Do I have to delete the directory and recreate it using -b feature/hal or is there a better git command?

If I try using the git clone -b feature/hal ... I get an error stating the destination directory already exists.

I did a bit of research on git and wonder if this will do what I am trying to do -

First create a local repository using the compile-server2 branch

mkdir Spark
cd Spark
git clone -b compile-server2 https://github.com/spark/firmware core-firmware
git clone -b compile-server2 https://github.com/spark/core-common-lib
git clone -b compile-server2 https://github.com/spark/core-communication-lib

This will leave you with a Spark directory that contains all of the firmware based on the compile-server2 branch

Then to switch to the feature/hal branch use the following -

cd Spark/core-firmware
git checkout feature/hal
cd ../core-common-lib
git checkout feature/hal
cd ../core-communication-lib
git checkout feature/hal

I’m just not sure if the checkout command actually changed any local files.

Is this the correct way to switch between branches on your local copy?

@mtnscott, the HAL branch is all inclusive and no longer uses core-communication and core-common repos. I have to confess that for simplicity, I have separate copies of the master and feature/hal repos so I don’t worry about checkout. :stuck_out_tongue:

2 Likes

Hey @peekay123,
I’m trying to compile some files with the hal Branch but it’s raising a lot of errors. Compiling with the master branch works fine with only some warnings.

looks like I’m lacking some file inclusion. Any idea?
best
Ron

Errors are like that:
applications/OSBH/OneWire.cpp:181:31: error: 'GPIOB' was not declared in this scope
         else if (gpio_port == GPIOB )
                               ^
applications/OSBH/OneWire.cpp:183:40: error: 'RCC_APB2Periph_GPIOB' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                        ^
applications/OSBH/OneWire.cpp:183:62: error: 'ENABLE' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                                              ^
applications/OSBH/OneWire.cpp:183:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                                                    ^
applications/OSBH/OneWire.cpp:186:5: error: 'GPIO_InitStructure' was not declared in this scope
     GPIO_InitStructure.GPIO_Pin = gpio_pin;
     ^
applications/OSBH/OneWire.cpp:187:33: error: 'GPIO_Mode_IN_FLOATING' was not declared in this scope
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

I solved the Issue including these files from hal/src/core-v1 into my code:

#include "gpio_hal.h"
#include "pinmap_impl.h"

it that the right way to go for?