Skip to content
Snippets Groups Projects
Commit f49b61a1 authored by schneider's avatar schneider
Browse files

Merge branch 'rahix/boot' into 'master'

Integrate bootloader into meson

See merge request card10/firmware!5
parents 54c13a79 cbb0f31e
No related branches found
No related tags found
No related merge requests found
Showing
with 182 additions and 181 deletions
......@@ -5,12 +5,9 @@ build:
before_script:
- echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
- apt update -qq
- apt install -y -qq gcc-arm-none-eabi python3-pip
- apt install -y -qq gcc-arm-none-eabi python3-pip git
- apt install -y -qq -t stretch-backports meson
- pip3 install crc16
script:
- cd bootloader
- make
- cd ..
- meson --cross-file card10-cross.ini build/
- ./bootstrap.sh
- ninja -C build/
file build/max32665.elf
file ../build/bootloader/bootloader.elf
target remote localhost:3333
################################################################################
# Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
# OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of Maxim Integrated
# Products, Inc. shall not be used except as stated in the Maxim Integrated
# Products, Inc. Branding Policy.
#
# The mere transfer of this software does not imply any licenses
# of trade secrets, proprietary technology, copyrights, patents,
# trademarks, maskwork rights, or any other form of intellectual
# property whatsoever. Maxim Integrated Products, Inc. retains all
# ownership rights.
#
# $Date: 2018-08-10 21:35:48 +0000 (Fri, 10 Aug 2018) $
# $Revision: 36863 $
#
###############################################################################
# This is the name of the build output file
ifeq "$(PROJECT)" ""
PROJECT=max32665
endif
# Specify the target processor
ifeq "$(TARGET)" ""
TARGET=MAX32665
endif
# Create Target name variables
TARGET_UC:=$(shell echo $(TARGET) | tr a-z A-Z)
TARGET_LC:=$(shell echo $(TARGET) | tr A-Z a-z)
# Select 'GCC' or 'IAR' compiler
COMPILER=GCC
# Specify the board used
ifeq "$(BOARD)" ""
#BOARD=EvKit_V1
BOARD=card10
endif
# This is the path to the CMSIS root directory
ifeq "$(MAXIM_PATH)" ""
LIBS_DIR=../lib/sdk/Libraries
else
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
endif
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
# Source files for this test (add path to VPATH below)
SRCS = main.c
SRCS += mscmem.c
SRCS += bootloader-usb.c
SRCS += crc16-ccitt.c
SRCS += ../lib/card10/mx25lba.c
# Where to find source files for this test
VPATH = .
# Where to find header files for this test
IPATH = .
IPATH += ../lib/card10
VPATH += ../lib/card10
# Enable assertion checking for development
PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE
# Specify the target revision to override default
# "A2" in ASCII
# TARGET_REV=0x4132
# Use this variables to specify and alternate tool path
#TOOL_DIR=/opt/gcc-arm-none-eabi-4_8-2013q4/bin
# Use these variables to add project specific tool options
#PROJ_CFLAGS+=--specs=nano.specs
#PROJ_LDFLAGS+=--specs=nano.specs
# Point this variable to a startup file to override the default file
#STARTUPFILE=start.S
# Set MXC_OPTIMIZE to override the default optimization level
#MXC_OPTIMIZE_CFLAGS=-Og
# Point this variable to a linker file to override the default file
LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC)_boot.ld
################################################################################
# Include external library makefiles here
# Include the BSP
BOARD_DIR=$(LIBS_DIR)/Boards/$(BOARD)
include $(BOARD_DIR)/board.mk
# Include the peripheral driver
PERIPH_DRIVER_DIR=$(LIBS_DIR)/$(TARGET_UC)PeriphDriver
include $(PERIPH_DRIVER_DIR)/periphdriver.mk
#include the FAT32 libraries
FAT32_DRIVER_DIR=../lib/ff13
include $(FAT32_DRIVER_DIR)/fat32.mk
MAXUSB_DIR=$(LIBS_DIR)/MAXUSB
include $(MAXUSB_DIR)/maxusb.mk
################################################################################
# Include the rules for building for this target. All other makefiles should be
# included before this one.
include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk
# The rule to clean out all the build products.
distclean: clean
$(MAKE) -C ${PERIPH_DRIVER_DIR} clean
#!/bin/sh
set -e
PYTHON="$1"
ELF="$2"
BIN="$3"
arm-none-eabi-objcopy -O binary "$ELF" "$BIN"
"$PYTHON" "$(dirname "$0")/crc_patch.py" "$BIN"
name = 'bootloader'
executable(
name + '.elf',
'main.c',
'mscmem.c',
'bootloader-usb.c',
'crc16-ccitt.c',
dependencies: [
libcard10,
max32665_startup_boot,
libff13,
maxusb,
],
link_whole: [max32665_startup_boot_lib, board_card10_lib],
link_args: [
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
# build_image.sh
build_image = [files('./build_image.sh'), python3]
name=$(basename `pwd`)
ninja -C ../../build -t clean hw-tests/$name/$name.elf
ninja -C ../../build hw-tests/$name/$name.elf
arm-none-eabi-objcopy -O binary ../../build/hw-tests/$name/$name.elf ../../build/hw-tests/$name/$name.bin
cp ../../build/hw-tests/$name/$name.bin card10.bin
../../bootloader/crc_patch.py card10.bin
name = 'bmatest'
executable(
elf = executable(
name + '.elf',
'main.c',
dependencies: [libcard10, max32665_startup],
......@@ -9,3 +9,11 @@ executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
custom_target(
name + '.bin',
build_by_default: true,
output: name + '.bin',
input: elf,
command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
name=$(basename `pwd`)
ninja -C ../../build -t clean hw-tests/$name/$name.elf
ninja -C ../../build hw-tests/$name/$name.elf
arm-none-eabi-objcopy -O binary ../../build/hw-tests/$name/$name.elf ../../build/hw-tests/$name/$name.bin
cp ../../build/hw-tests/$name/$name.bin card10.bin
../../bootloader/crc_patch.py card10.bin
name = 'bmetest'
executable(
elf = executable(
name + '.elf',
'main.c',
dependencies: [libcard10, max32665_startup],
......@@ -9,3 +9,11 @@ executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
custom_target(
name + '.bin',
build_by_default: true,
output: name + '.bin',
input: elf,
command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
name=$(basename `pwd`)
ninja -C ../../build -t clean hw-tests/$name/$name.elf
ninja -C ../../build hw-tests/$name/$name.elf
arm-none-eabi-objcopy -O binary ../../build/hw-tests/$name/$name.elf ../../build/hw-tests/$name/$name.bin
cp ../../build/hw-tests/$name/$name.bin card10.bin
../../bootloader/crc_patch.py card10.bin
name = 'ecgtest'
executable(
elf = executable(
name + '.elf',
'main.c',
dependencies: [libcard10, max32665_startup],
......@@ -9,3 +9,11 @@ executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
custom_target(
name + '.bin',
build_by_default: true,
output: name + '.bin',
input: elf,
command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
......@@ -16,7 +16,7 @@ sources = files(
'main.c',
)
executable(
elf = executable(
name + '.elf',
sources,
include_directories: freertos_sdk_includes,
......@@ -27,3 +27,11 @@ executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
custom_target(
name + '.bin',
build_by_default: true,
output: name + '.bin',
input: elf,
command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
name=$(basename `pwd`)
ninja -C ../../build -t clean hw-tests/$name/$name.elf
ninja -C ../../build hw-tests/$name/$name.elf
arm-none-eabi-objcopy -O binary ../../build/hw-tests/$name/$name.elf ../../build/hw-tests/$name/$name.bin
cp ../../build/hw-tests/$name/$name.bin card10.bin
../../bootloader/crc_patch.py card10.bin
name = 'hello-world'
executable(
elf = executable(
name + '.elf',
'main.c',
dependencies: [libcard10, max32665_startup],
......@@ -9,3 +9,11 @@ executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
custom_target(
name + '.bin',
build_by_default: true,
output: name + '.bin',
input: elf,
command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
name=$(basename `pwd`)
ninja -C ../../build -t clean hw-tests/$name/$name.elf
ninja -C ../../build hw-tests/$name/$name.elf
arm-none-eabi-objcopy -O binary ../../build/hw-tests/$name/$name.elf ../../build/hw-tests/$name/$name.bin
cp ../../build/hw-tests/$name/$name.bin card10.bin
../../bootloader/crc_patch.py card10.bin
name = 'imutest'
executable(
elf = executable(
name + '.elf',
'main.c',
dependencies: [libcard10, max32665_startup],
......@@ -9,3 +9,11 @@ executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
custom_target(
name + '.bin',
build_by_default: true,
output: name + '.bin',
input: elf,
command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
name=$(basename `pwd`)
ninja -C ../../build -t clean hw-tests/$name/$name.elf
ninja -C ../../build hw-tests/$name/$name.elf
arm-none-eabi-objcopy -O binary ../../build/hw-tests/$name/$name.elf ../../build/hw-tests/$name/$name.bin
cp ../../build/hw-tests/$name/$name.bin card10.bin
../../bootloader/crc_patch.py card10.bin
name = 'ips'
executable(
elf = executable(
name + '.elf',
'main.c',
'image/image.c',
......@@ -11,3 +11,11 @@ executable(
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
)
custom_target(
name + '.bin',
build_by_default: true,
output: name + '.bin',
input: elf,
command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
......@@ -31,3 +31,31 @@ libcard10 = declare_dependency(
link_with: lib,
dependencies: deps,
)
##########################################################
includes = include_directories(
'./',
)
sources = files(
'mx25lba.c',
)
deps = [
board_card10,
periphdriver,
]
lib = static_library(
'mx25lba',
sources,
include_directories: includes,
dependencies: deps,
)
mx25lba = declare_dependency(
include_directories: includes,
link_with: lib,
dependencies: deps,
)
/*******************************************************************************
* Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Maxim Integrated
* Products, Inc. shall not be used except as stated in the Maxim Integrated
* Products, Inc. Branding Policy.
*
* The mere transfer of this software does not imply any licenses
* of trade secrets, proprietary technology, copyrights, patents,
* trademarks, maskwork rights, or any other form of intellectual
* property whatsoever. Maxim Integrated Products, Inc. retains all
* ownership rights.
*
* Description: Communications Device Class ACM (Serial Port) over USB
* $Id: descriptors.h 31172 2017-10-05 19:05:57Z zach.metzinger $
*
*******************************************************************************
*/
/**
* @file mscmem.h
* @brief Memory routines used by the USB Mass Storage Class example.
* See the msc_mem_t structure in msc.h for function details.
*/
#ifndef __MSC_MEM_H__
#define __MSC_MEM_H__
#include <stdint.h>
int mscmem_init(void);
int mscmem_start(void);
int mscmem_stop(void);
uint32_t mscmem_size(void);
int mscmem_read(uint32_t lba, uint8_t* buffer);
int mscmem_write(uint32_t lba, uint8_t* buffer);
int mscmem_ready(void);
#endif /* __MSC_MEM_H__ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment