Skip to content

Commit

Permalink
fw: generate binaries with 1M baud for dongles
Browse files Browse the repository at this point in the history
Many popular dongles such as the Sonoff CC2652P dongle and Slaesh
CC2652RB dongle contain Silicon Labs CP2102 USB/UART adapters that
support a maximum baud rate of 1M. These devices also don't have
XDS110 debuggers, so they instead use the ROM bootloader for flashing.
The JelmerT/cc2538-bsl utility doesn't support ELF files, so I'll ship
binaries to directly write to flash instead.
  • Loading branch information
sultanqasim committed Apr 23, 2024
1 parent cd153a0 commit de7e919
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
12 changes: 11 additions & 1 deletion fw/build_all_platforms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cp sniffle.out builds/sniffle_cc2652rb.out

make clean
make -j3 PLATFORM=CC1352P1F3
cp sniffle.out builds/sniffle_cc1352p1.out
cp sniffle.out builds/sniffle_cc1352p1_cc2652p1.out

make clean
make -j3 PLATFORM=CC2652R74
Expand All @@ -35,3 +35,13 @@ cp sniffle.out builds/sniffle_cc2651p3.out
make clean
make -j3 PLATFORM=CC1354P106
cp sniffle.out builds/sniffle_cc1354p10.out

# Export .bin files for CP2102 based dongles with 1M baud, so they can be
# flashed with cc2538-bsl without needing objdump to convert .out to .bin
make clean
make -j3 PLATFORM=CC2652RB1F_1M
cp sniffle.bin builds/sniffle_cc2652rb_1M.bin

make clean
make -j3 PLATFORM=CC2652P1F_1M
cp sniffle.bin builds/sniffle_cc1352p1_cc2652p1_1M.bin
10 changes: 8 additions & 2 deletions fw/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ NAME = sniffle

CC26X2R1_PLATFORMS = CC2642R1F CC2652R1F
CC1352R1_PLATFORMS = CC1352R1F3
CC2652RB_PLATFORMS = CC2652RB1F
CC1352P1_PLATFORMS = CC1352P1F3
CC2652RB_PLATFORMS = CC2652RB1F CC2652RB1F_1M
CC1352P1_PLATFORMS = CC1352P1F3 CC2652P1F CC1352P1F3_1M CC2652P1F_1M
CC2652R7_PLATFORMS = CC2652R74
CC1352P7_PLATFORMS = CC1352P74
CC2651P3_PLATFORMS = CC2651P31
CC1354P10_PLATFORMS = CC1354P106

1M_BAUD_PLATFORMS = CC2652RB1F_1M CC1352P1F3_1M CC2652P1F_1M

SUPPORTED_PLATFORMS = \
$(CC26X2R1_PLATFORMS) \
$(CC1352R1_PLATFORMS) \
Expand Down Expand Up @@ -80,6 +82,10 @@ ifneq ($(filter $(PLATFORM), $(CC1354P10_PLATFORMS)),)
HARD_FLOAT = 2
endif

ifneq ($(filter $(PLATFORM), $(1M_BAUD_PLATFORMS)),)
CFLAGS += -DUART_1M_BAUD
endif

ifeq ($(HARD_FLOAT),2)
CFLAGS += -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mcpu=cortex-m33
LFLAGS += -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mcpu=cortex-m33
Expand Down
4 changes: 4 additions & 0 deletions fw/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

UART2_Handle uart;

#ifdef UART_1M_BAUD
static const uint32_t BAUD_RATE = 1000000;
#else
static const uint32_t BAUD_RATE = 2000000;
#endif

int messenger_init()
{
Expand Down

0 comments on commit de7e919

Please sign in to comment.