A .gitlab-ci.yml => .gitlab-ci.yml +72 -0
@@ 0,0 1,72 @@
+stages:
+ - build
+ - deploy
+
+.variables_template: &variables_definition
+ variables:
+ BASE_NAME: "dfuse_pack"
+ PKG_CONFIG_PATH: "/opt/lv2/lib/pkgconfig:/opt/${CI_BUILD_NAME}/lib/pkgconfig"
+ TOOLCHAIN_FILE: "${CI_PROJECT_DIR}/cmake/${CI_BUILD_NAME}.cmake"
+
+.common_template: &common_definition
+ <<: *variables_definition
+ stage: build
+ artifacts:
+ name: "${BASE_NAME}-$(cat VERSION)-${CI_BUILD_NAME}"
+ paths:
+ - "${BASE_NAME}-$(cat VERSION)/"
+
+.build_template: &build_definition
+ <<: *common_definition
+ script:
+ - mkdir build
+ - pushd build
+ - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${CI_PROJECT_DIR}/${BASE_NAME}-$(cat ../VERSION)/${CI_BUILD_NAME}" -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} ..
+ - cmake .. # needed for darwin
+ - make
+ - make install
+
+.universal_linux_template: &universal_linux_definition
+ image: ventosus/universal-linux-gnu
+ <<: *build_definition
+
+.arm_linux_template: &arm_linux_definition
+ image: ventosus/arm-linux-gnueabihf
+ <<: *build_definition
+
+.universal_w64_template: &universal_w64_definition
+ image: ventosus/universal-w64-mingw32
+ <<: *build_definition
+
+.universal_apple_template: &universal_apple_definition
+ image: ventosus/universal-apple-darwin
+ <<: *build_definition
+
+# building in docker
+x86_64-linux-gnu:
+ <<: *universal_linux_definition
+
+i686-linux-gnu:
+ <<: *universal_linux_definition
+
+arm-linux-gnueabihf:
+ <<: *arm_linux_definition
+
+x86_64-w64-mingw32:
+ <<: *universal_w64_definition
+
+i686-w64-mingw32:
+ <<: *universal_w64_definition
+
+universal-apple-darwin:
+ <<: *universal_apple_definition
+
+pack:
+ <<: *variables_definition
+ stage: deploy
+ script:
+ - echo 'packing up...'
+ artifacts:
+ name: "${BASE_NAME}-$(cat VERSION)"
+ paths:
+ - "${BASE_NAME}-$(cat VERSION)/"
M CMakeLists.txt => CMakeLists.txt +4 -0
@@ 2,6 2,10 @@ cmake_minimum_required(VERSION 2.8)
project(dfuse_pack)
+set(CMAKE_C_FLAGS "-fdata-sections -ffunction-sections ${CMAKE_C_FLAGS}")
+set(CMAKE_C_FLAGS "-std=gnu11 -Wextra -Wno-unused-parameter -ffast-math -fvisibility=hidden ${CMAKE_C_FLAGS}")
+set(CMAKE_C_FLAGS "-Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes ${CMAKE_C_FLAGS}")
+
include_directories("${PROJECT_SOURCE_DIR}")
# dfuse_pack
M README.md => README.md +1 -1
@@ 6,7 6,7 @@ This command line utility lets you pack raw binary firmware images into a DfuSe
### Build status
-[![Build Status](https://travis-ci.org/OpenMusicKontrollers/dfuse_pack.svg?branch=master)](https://travis-ci.org/OpenMusicKontrollers/dfuse_pack)
+[![build status](https://gitlab.com/OpenMusicKontrollers/dfuse_pack/badges/master/build.svg)](https://gitlab.com/OpenMusicKontrollers/dfuse_pack/commits/master)
### Dependencies
A VERSION => VERSION +1 -0
A cmake/arm-linux-gnueabihf.cmake => cmake/arm-linux-gnueabihf.cmake +18 -0
@@ 0,0 1,18 @@
+# the name of the target operating system
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR "armv7h")
+set(TOOLCHAIN "arm-linux-gnueabihf")
+
+# which compilers to use for C and C++
+set(CMAKE_C_COMPILER "${TOOLCHAIN}-gcc")
+set(CMAKE_CXX_COMPILER "${TOOLCHAIN}-g++")
+
+# here is the target environment located
+set(CMAKE_FIND_ROOT_PATH "usr/${TOOLCHAIN}")
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
A cmake/i686-linux-gnu.cmake => cmake/i686-linux-gnu.cmake +7 -0
@@ 0,0 1,7 @@
+# the name of the target operating system
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR "i686")
+set(TOOLCHAIN "i686-linux-gnu")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags")
A cmake/i686-w64-mingw32.cmake => cmake/i686-w64-mingw32.cmake +23 -0
@@ 0,0 1,23 @@
+# the name of the target operating system
+set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR "i686")
+set(TOOLCHAIN "i686-w64-mingw32")
+
+# which compilers to use for C and C++
+set(CMAKE_C_COMPILER "${TOOLCHAIN}-gcc")
+set(CMAKE_CXX_COMPILER "${TOOLCHAIN}-g++")
+set(CMAKE_RC_COMPILER "${TOOLCHAIN}-windres")
+
+# here is the target environment located
+set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN}")
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+set(LIBS ${LIBS} "-static-libgcc")
+
+set(WINE wine32)
A cmake/universal-apple-darwin.cmake => cmake/universal-apple-darwin.cmake +20 -0
@@ 0,0 1,20 @@
+# the name of the target operating system
+set(CMAKE_SYSTEM_NAME Darwin)
+set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+set(TOOLCHAIN "universal-apple-darwin")
+
+set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
+
+# which compilers to use for C and C++
+set(CMAKE_C_COMPILER "/usr/${TOOLCHAIN}/bin/x86_64-apple-darwin15-clang")
+set(CMAKE_CXX_COMPILER "/usr/${TOOLCHAIN}/bin/x86_64-apple-darwin15-clang++")
+
+# here is the target environment located
+set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN}")
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
A cmake/x86_64-linux-gnu.cmake => cmake/x86_64-linux-gnu.cmake +4 -0
@@ 0,0 1,4 @@
+# the name of the target operating system
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+set(TOOLCHAIN "x86_64-linux-gnu")
A cmake/x86_64-w64-mingw32.cmake => cmake/x86_64-w64-mingw32.cmake +23 -0
@@ 0,0 1,23 @@
+# the name of the target operating system
+set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+set(TOOLCHAIN "x86_64-w64-mingw32")
+
+# which compilers to use for C and C++
+set(CMAKE_C_COMPILER "${TOOLCHAIN}-gcc")
+set(CMAKE_CXX_COMPILER "${TOOLCHAIN}-g++")
+set(CMAKE_RC_COMPILER "${TOOLCHAIN}-windres")
+
+# here is the target environment located
+set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN}")
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+set(LIBS ${LIBS} "-static-libgcc")
+
+set(WINE wine64)
M dfuse_pack.c => dfuse_pack.c +16 -16
@@ 84,8 84,8 @@ crc32_update_no_xor (uint32_t crc, uint8_t *buf, size_t len)
return crc;
}
-DfuSe_Entry *
-new_entry()
+static DfuSe_Entry *
+new_entry(void)
{
DfuSe_Entry *entry = calloc(1, sizeof(DfuSe_Entry));
@@ 99,8 99,8 @@ new_entry()
return entry;
}
-DfuSe_Entry_Image *
-new_image()
+static DfuSe_Entry_Image *
+new_image(void)
{
DfuSe_Entry_Image *image = calloc(1, sizeof(DfuSe_Entry_Image));
@@ 117,7 117,7 @@ new_image()
(LIST); \
(LIST) = (LIST)->next, (DATA) = (LIST) ? (LIST)->data : NULL, free(HEAD))
-DfuSe_List *
+static DfuSe_List *
list_append(DfuSe_List *list, void *data)
{
DfuSe_List *next = malloc(sizeof(DfuSe_List));
@@ 143,7 143,7 @@ list_append(DfuSe_List *list, void *data)
return list;
}
-size_t
+static size_t
list_count(DfuSe_List *list)
{
size_t count = 0;
@@ 186,7 186,7 @@ main (int argc, char **argv)
entry = entry ? entry : new_entry();
entry->tPrefix.bAlternateSetting = asetting;
if(!entry->images)
- FAIL("at least one image [-i] needed for altsetting %i\n", entry->tPrefix.bAlternateSetting);
+ FAIL("at least one image [-i] needed for altsetting %"PRIu8"\n", entry->tPrefix.bAlternateSetting);
targets = list_append(targets, entry);
entry = NULL;
break;
@@ 314,11 314,11 @@ main (int argc, char **argv)
// write container to file
printf("Output container: %s\n", out);
- printf("Firmware version: 0x%04x\n", version);
- printf("Product ID: 0x%04x\n", product);
- printf("Vendor ID: 0x%04x\n", vendor);
- printf("Targets: %zu\n", list_count(targets));
- printf("CRC: 0x%04x\n\n", crc);
+ printf("Firmware version: 0x%04"PRIx16"\n", version);
+ printf("Product ID: 0x%04"PRIx16"\n", product);
+ printf("Vendor ID: 0x%04"PRIx16"\n", vendor);
+ printf("Targets: %"PRIuPTR"\n", list_count(targets));
+ printf("CRC: 0x%04"PRIx32"\n\n", crc);
if(!(dfuse = fopen(out, "wb")))
FAIL("could not open output file '%s'\n", out);
@@ 326,8 326,8 @@ main (int argc, char **argv)
LIST_FOREACH(targets, l, entry)
{
printf("Target\n");
- printf("\tAltsetting: %i\n", entry->tPrefix.bAlternateSetting);
- printf("\tImages: %zu\n", list_count(entry->images));
+ printf("\tAltsetting: %"PRIu8"\n", entry->tPrefix.bAlternateSetting);
+ printf("\tImages: %"PRIuPTR"\n", list_count(entry->images));
printf("\tName: %s\n\n", entry->tPrefix.szTargetName);
fwrite (&entry->tPrefix, DFUSE_TARGET_PREFIX_SIZE, 1, dfuse);
@@ 335,8 335,8 @@ main (int argc, char **argv)
{
printf("\tImage\n");
printf("\t\tPath: %s\n", image->path);
- printf("\t\tAddress: 0x%08x\n", image->element.dwElementAddress);
- printf("\t\tSize: %i bytes\n\n", image->len);
+ printf("\t\tAddress: 0x%08"PRIx32"\n", image->element.dwElementAddress);
+ printf("\t\tSize: %"PRIu32" bytes\n\n", image->len);
fwrite (&image->element, DFUSE_IMAGE_ELEMENT_SIZE, 1, dfuse);
fwrite (image->buf, sizeof(uint8_t), image->len, dfuse);