Skip to content

Commit

Permalink
Firmware v1.3 with Babel-Babel related fixes and updated external lin…
Browse files Browse the repository at this point in the history
…ks (#4)

* Update the compiler and bump the minor versions

* Pull up the CAN disable output to allow the device to function without a pull-up resistor on this line

* Update the LaTeX template

* Update the datasheet

* Fix crash when opening the channel by disabling strict-aliasing
  • Loading branch information
pavel-kirienko authored Dec 20, 2021
1 parent 1a8187a commit 0e416c2
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ __pycache__

# Temporary
*.log
*.tmp

# Eclipse
.metadata
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# [Zubax Babel](https://zubax.com/products/babel)

[![Join the chat at https://gitter.im/Zubax/general](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/Zubax/general)
[![Forum](https://img.shields.io/discourse/https/forum.zubax.com/users.svg?color=e00000)](https://forum.zubax.com)
[![Forum](https://img.shields.io/discourse/https/forum.uavcan.org/users.svg?color=1700b3)](https://forum.uavcan.org)

Zubax Babel is a high performance USB-CAN and UART-CAN adapter that can be used as a
standalone device or as an embeddable module for original equipment manufacturers (OEM).

Babel implements the quasi-standard SLCAN protocol (aka LAWICEL protocol) that is understood by
majority of CAN software products, including the Linux SocketCAN framework.
If Babel is used with [UAVCAN](http://uavcan.org) networks,
we recommend to use the [UAVCAN GUI Tool](http://uavcan.org/GUI_Tool),
which fully supports all of the advanced features available in Zubax Babel.
we recommend to use the [Yakut CLI tool](https://github.com/UAVCAN/yakut).

[**ZUBAX BABEL HOMEPAGE**](https://zubax.com/products/babel).

Expand Down Expand Up @@ -37,11 +37,13 @@ This algoritm is employed in the SLCAN backend in [PyUAVCAN library](http://uavc

## Firmware

If you're not running Linux or OSX natively, you can use
[Bistromathic - a Linux virtual machine pre-configured for embedded development](https://kb.zubax.com/x/KIEh).

### Change Log

#### v1.3

* Fix a hardware compatibility problem for Babel-Babel:
enable the built-in pull-up resistor on the CAN power disable line.

#### v1.2

* Added a new CLI command: `gpio`. This command allows one to control the SMD GPIO pads via USB/UART.
Expand All @@ -61,7 +63,7 @@ Initial release.

### Building

Install ARM GCC toolchain version 6.3.
Install ARM GCC toolchain of the correct version (consult with `main.cpp`).
Clone this repository, init all submodules (`git submodule update --init --recursive`),
then execute the following from the repository root:

Expand Down
5 changes: 3 additions & 2 deletions bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PROJECT = com.zubax.babel

HW_VERSION = 1
BL_VERSION_MAJOR = 1
BL_VERSION_MINOR = 1
BL_VERSION_MINOR = 2

APPLICATION_OFFSET = 32768

Expand Down Expand Up @@ -66,7 +66,8 @@ DEBUG_OPT = -Os -g3 -DDISABLE_WATCHDOG=1

LDSCRIPT = ld.ld

CWARN += -Wshadow -Wpointer-arith -Wno-packed -Wno-attributes -Wno-error=undef -Wno-error=shadow
CWARN += -Wshadow -Wpointer-arith -Wno-packed -Wno-attributes -Wno-error=undef \
-Wno-error=shadow -Wno-error=implicit-fallthrough -Wno-class-memaccess -Wno-bool-operation
CPPWARN += $(CWARN)

include zubax_chibios/rules_stm32f37x.mk
2 changes: 1 addition & 1 deletion bootloader/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,6 @@ int main()
#define MATCH_GCC_VERSION(major, minor, patch) \
((__GNUC__ == (major)) && (__GNUC_MINOR__ == (minor)) && (__GNUC_PATCHLEVEL__ == (patch)))

#if !(MATCH_GCC_VERSION(6, 3, 1))
#if !(MATCH_GCC_VERSION(10, 3, 1))
# error "This compiler is not supported"
#endif
2 changes: 1 addition & 1 deletion bootloader/src/sys/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
PIN_PUPDR_PULLDOWN(GPIOA_PIN_5) |\
PIN_PUPDR_PULLDOWN(GPIOA_PIN_6) |\
PIN_PUPDR_PULLDOWN(7) |\
PIN_PUPDR_FLOATING(GPIOA_CAN_POWER_DIS) |\
PIN_PUPDR_PULLUP(GPIOA_CAN_POWER_DIS) |\
PIN_PUPDR_FLOATING(GPIOA_UART1_TX) |\
PIN_PUPDR_PULLUP(GPIOA_UART1_RX) |\
PIN_PUPDR_FLOATING(GPIOA_USB_DM) |\
Expand Down
6 changes: 3 additions & 3 deletions docs/datasheet/Zubax_Babel_Datasheet.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%
% Copyright (c) 2017-2019 Zubax Robotics <[email protected]>
% Copyright (c) 2017 Zubax Robotics <[email protected]>
%
% Distributed under BY-NC-ND (attribution required, non-commercial use only, no derivatives).
%
Expand Down Expand Up @@ -65,7 +65,7 @@ \section*{Applications}
\begin{itemize}
\item General-purpose USB-CAN or UART-CAN adapter.
\item Diagnostic, monitoring, and development tool for \href{http://uavcan.org}{UAVCAN} networks.
We recommend the UAVCAN GUI Tool for use with UAVCAN applications.
We recommend Yakut for use with UAVCAN applications.
\item Generic CAN/UAVCAN development board.
\item Programmable CAN unit in OEM applications.
\end{itemize}
Expand Down Expand Up @@ -1319,7 +1319,7 @@ \section{Configuration parameter index}
\tabularnewline
}%
\newenvironment{CfgParamIndex}[1]{%
\begin{ZubaxTableWrapper}{#1}
\begin{ZubaxTableWrapper}[wide]{#1}
\setlength\tabcolsep{2.5pt}
\begin{ZubaxWrappedTable}{@{} l c l l | c c c | X @{}}
Name & \makecell[cb]{SLCAN\\alias} & \makecell[lb]{Takes\\effect at} & Pages & Min & Max & Def. & Description \\
Expand Down
4 changes: 4 additions & 0 deletions docs/datasheet/clean.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env pwsh

rm -f *.aux *.lof *.lot *.out *.toc *.log *.fls *.gz *-converted-to.* *.cache
rm -rf _minted-*
6 changes: 6 additions & 0 deletions docs/datasheet/compile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env pwsh
param ($texfile='Zubax_Babel_Datasheet.tex')
Set-Location (Split-Path $script:MyInvocation.MyCommand.Path)
pdflatex --halt-on-error --shell-escape $texfile
pdflatex --halt-on-error --shell-escape $texfile
pdflatex --halt-on-error --shell-escape $texfile
19 changes: 10 additions & 9 deletions firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PROJECT = com.zubax.babel

HW_VERSION_MAJOR = 1
FW_VERSION_MAJOR = 1
FW_VERSION_MINOR = 2
FW_VERSION_MINOR = 3

#
# Application
Expand Down Expand Up @@ -64,12 +64,13 @@ USE_LTO := yes
SERIAL_CLI_PORT_NUMBER = 1

RELEASE ?= 0
RELEASE_OPT = -O3 -fomit-frame-pointer # -g3 # -g3 is needed for profiling
DEBUG_OPT = -O2 -g3 -DDISABLE_WATCHDOG=1
RELEASE_OPT = -O3 -fomit-frame-pointer -ggdb -fno-strict-aliasing
DEBUG_OPT = -O2 -ggdb -DDISABLE_WATCHDOG=1 -fno-strict-aliasing

LDSCRIPT = ld.ld

CWARN += -Wshadow -Wpointer-arith -Wno-packed -Wno-attributes -Wno-error=undef -Wno-error=shadow
CWARN += -Wshadow -Wpointer-arith -Wno-packed -Wno-attributes -Wno-error=undef \
-Wno-error=shadow -Wno-error=implicit-fallthrough -Wno-class-memaccess -Wno-bool-operation
CPPWARN += $(CWARN)

#
Expand All @@ -85,26 +86,26 @@ BOOTLOADER_IMAGE := $(BOOTLOADER_DIR)/build/com.zubax.babel.bin
POST_MAKE_ALL_RULE_HOOK: build/$(PROJECT).bin build/$(PROJECT).elf
# Building the bootloader
+cd $(BOOTLOADER_DIR) && make RELEASE=$(RELEASE)

# Removing previous build outputs that could use a different git hash
rm -rf build/*.application.bin build/*.compound.bin

# Generating compound image with embedded bootloader
cd build && dd if=/dev/zero bs=$(BOOTLOADER_SIZE) count=1 | tr "\000" "\377" >padded_bootloader.tmp.bin
cd build && dd if=$(BOOTLOADER_IMAGE) of=padded_bootloader.tmp.bin conv=notrunc
cd build && cat padded_bootloader.tmp.bin $(PROJECT).bin >$(COMPOUND_IMAGE_FILE)

# Generating the signed image for the bootloader
cd build && ../zubax_chibios/tools/make_boot_descriptor.py $(PROJECT).bin $(PROJECT) $(HW_VERSION_MAJOR) \
--also-patch-descriptor-in=$(PROJECT).elf \
--also-patch-descriptor-in=$(COMPOUND_IMAGE_FILE)

# Injecting the bootloader into the final ELF; note that we're using unpadded bootloader to preserve signature
cd build && $(TOOLCHAIN_PREFIX)-objcopy --add-section bootloader=$(BOOTLOADER_IMAGE) \
--set-section-flags bootloader=load,alloc \
--change-section-address bootloader=0x08000000 \
$(PROJECT).elf compound.elf

# Removing temporary files
cd build && rm -f $(PROJECT).bin $(PROJECT).elf *.hex *.tmp.bin

Expand Down
3 changes: 2 additions & 1 deletion firmware/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@ int main()
#define MATCH_GCC_VERSION(major, minor, patch) \
((__GNUC__ == (major)) && (__GNUC_MINOR__ == (minor)) && (__GNUC_PATCHLEVEL__ == (patch)))

#if !(MATCH_GCC_VERSION(6, 3, 1))
#if !(MATCH_GCC_VERSION(10, 3, 1))
# error __GNUC__
# error "This compiler is not supported"
#endif

0 comments on commit 0e416c2

Please sign in to comment.