Skip to content

Commit

Permalink
add git commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
DESKTOP-M9CCUTI\ian committed Aug 12, 2024
1 parent 16fa6cb commit f5e12df
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 5 deletions.
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ set(PICO_BOARD_CMAKE_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards )
# Add my_pico_w
#
#set(BP_PICO_PLATFORM "rp2350")

if(DEFINED ${GIT_COMMIT_HASH})
set(BP_FIRMWARE_HASH ${GIT_COMMIT_HASH})
else()
set(BP_FIRMWARE_HASH "unknown")
endif()

if(${BP_PICO_PLATFORM} MATCHES "rp2350")
set(PICO_PLATFORM "rp2350") #compile for 5XL and 6
set(PICO_BOARD buspirate6)
Expand All @@ -46,6 +53,8 @@ else()
set(PICO_BOARD buspirate5)
endif()



# Pull in Raspberry Pi Pico SDK (must be before project)
include(cmake/pico_sdk_import.cmake)

Expand All @@ -54,8 +63,6 @@ project(bus_pirate C CXX ASM)
# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()

#add_compile_definitions(BP_FIRMWARE_HASH=${BP_FIRMWARE_HASH})

# build time in UTC ISO 8601
FILE (WRITE ${CMAKE_BINARY_DIR}/timestamp.cmake "STRING(TIMESTAMP TIMEZ UTC)\n")
FILE (APPEND ${CMAKE_BINARY_DIR}/timestamp.cmake "FILE(WRITE timestamp.h \"#ifndef TIMESTAMP_H\\n\")\n")
Expand Down
5 changes: 3 additions & 2 deletions commands/global/i_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ void i_info_handler(struct command_result *res){
printf("\r\n%sThis device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.%s\r\n\r\n", ui_term_color_info(), ui_term_color_reset());

printf("\r\n%s\r\n", BP_HARDWARE_VERSION);
printf("%s %s%s%s (%s%s%s)\r\n",
printf("%s %s%s%s @ %s (%s%s%s)\r\n",
t[T_INFO_FIRMWARE],
ui_term_color_num_float(),
BP_FIRMWARE_VERSION,
ui_term_color_reset(),
BP_FIRMWARE_HASH,
ui_term_color_num_float(),
BP_FIRMWARE_HASH,
BP_FIRMWARE_TIMESTAMP,
ui_term_color_reset());
printf("%s%s%s %s %s%s%s %s, %s%s%s %s\r\n",
ui_term_color_num_float(),
Expand Down
38 changes: 38 additions & 0 deletions hacks/build_server_condensed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Install git
```
sudo add-apt-repository -y ppa:git-core/ppa && sudo apt install -y git && git --version
```

# Install CMake
```
sudo wget -qO /etc/apt/trusted.gpg.d/kitware-key.asc https://apt.kitware.com/keys/kitware-archive-latest.asc && echo "deb https://apt.kitware.com/ubuntu/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/kitware.list && sudo apt update && sudo apt install -y cmake && cmake --version
```

# Install gcc-arm
```
curl -Lo gcc-arm-none-eabi.tar.bz2 "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2" && sudo mkdir /opt/gcc-arm-none-eabi && sudo tar xf gcc-arm-none-eabi.tar.bz2 --strip-components=1 -C /opt/gcc-arm-none-eabi
echo 'export PATH=$PATH:/opt/gcc-arm-none-eabi/bin' | sudo tee -a /etc/profile.d/gcc-arm-none-eabi.sh && source /etc/profile && arm-none-eabi-gcc --version && arm-none-eabi-g++ --version && rm -rf gcc-arm-none-eabi.tar.bz2
```

# Install pico sdk
```
sudo git clone https://github.com/raspberrypi/pico-sdk.git /opt/pico-sdk && sudo git -C /opt/pico-sdk submodule update --init
echo 'export PICO_SDK_PATH=/opt/pico-sdk' | sudo tee -a /etc/profile.d/pico-sdk.sh
source /etc/profile.d/pico-sdk.sh
```

# Install BP5
```
sudo git clone https://github.com/DangerousPrototypes/BusPirate5-firmware.git bp5-main && cd bp5-main &&mkdir build && cd build && cmake .. && make
```

# Install build script and webhook
```
cd ~ && mkdir webhook && pip install virtualenv && pip install argparse && pip install python-dotenv && apt install python3.10-venv && python3.10 -m venv env && sudo apt install build-essential libssl-dev libffi-dev python3-dev && source env/bin/activate && pip3 install flask && pip3 install github_webhook && pip3 install requests && sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT && sudo apt-get install iptables-persistent
screen
python3 webhook.py
```
5 changes: 4 additions & 1 deletion pirate.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

#define BP_FIRMWARE_VERSION "main branch"
#ifndef BP_FIRMWARE_HASH //this variable is for the current commit GIT hash
#define BP_FIRMWARE_HASH _TIMEZ_
#define BP_FIRMWARE_HASH "unknown"
#endif
#ifndef BP_FIRMWARE_TIMESTAMP //this variable is for the current commit GIT hash
#define BP_FIRMWARE_TIMESTAMP _TIMEZ_
#endif

#define BP_SPI_START_SPEED 1000 * 1000
Expand Down

0 comments on commit f5e12df

Please sign in to comment.