elazarrosenthal / AtcWatchBuilder

0 stars 0 forks source link

Success report #1

Open drtonyr opened 2 years ago

drtonyr commented 2 years ago

I'm very pleased to have built my first ATCwatch.ino.zip and it works!

There was only one hurdle, that was my Linux (Ubuntu 20.04.3 LTS with Lambdastack) has no i386 support. This manifests as 'bash setup watchdirNoi386' saying:

Selected fqbn: nRF52D6Fitness:nRF5:dsd6Watch

Error during build: fork/exec /home/tonyr/AtcWatchBuilder/watchdirNoi386/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/arm-none-eabi-g++: no such file or directory

The file arm-none-eabi-g++ does exist, it's just 32-bit

In the past this was easy to add, something like apt-get install libc6:i386 worked fine. With my current setup I needed the magic incantation: aptitude install libc6=2.31-0ubuntu9.2 libc6-dev=2.31-0ubuntu9.2 libc6-dbg=2.31-0ubuntu9.

And that was all, it ran through to give me a ATCwatch.ino.zip (the default was to define P8WATCH which is what I wanted).

THANKS A LOT!

(for completeness, DaFlasher also failed on Andriod12 and Androd11 nRF Connect worked fine)

elazarrosenthal commented 2 years ago

Thanks While I have been in software dev for a long time (since the late 80s)

I am no Arduino expert

I put together for myself and want to hand back to Aaron Christophel I put the initial script in an issue on ATCwatch but I kept making changes so I put in a repo

elazarrosenthal commented 2 years ago

You might find this useful

Most of my c/c++ development has been done with command line make/vi

I am currently working in Java and got somewhat spoiled by intelij

I looked for a C/++ ide I tried codeblocks but it did not work for me

I installed Microsoft vs code on my linux box

I cd to the watch dir that is build with my script

do $ code . open a terminal window withing code run bash .,/build

I can jump to files where errors are directly it knows all the functions and #defines (so I don't have to keep grepping for what I want in the code tree) it also can reformat the code ...

Make sure to let it install all the helpers it suggests (for c files and the like)

I was finally able to make some tweaks to the watch code that I have been playing with for about 2 years but always put off because I had to flip to windows and the Arduino IDE leave much to be desired

Just sharing what worked for me if you have something better good.

elazarrosenthal commented 2 years ago

good to hear I don't think I need the details I have worked mainly with 1 watch with BLE updates have not had a problem

I had tried the build on 2 linux systems but they may have both had your missing package installed on them at some point over the years

stefan123t commented 2 years ago

Dear @elazarrosenthal,

as mentioned elsewhere upstream your script works wonders without any changes! I had to do a lot more to make it work without the help of your script.

Here is what I had to do in order to get it running manually in Arduino IDE (not CLI):

In fact I modified the following two files manually:

If you want I could provide you some universal diff files to make the patching of those two/three files easier and the changes more explicit ?

@atc1441 I added some questions regarding the libraries for you below. Maybe you can give us your idea about upgrading those ?

Kind regards, Stefan


  1. File > Preferences Additional Board Manager URLs:

    https://atc1441.github.io/D6Library/package_nRF5_boards_index.json
    https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json
  2. Tools > Board > Board Manager

I have not compared the differences between these board configurations yet.

  1. Tools > Manage Libraries

3.1. Time

@atc1441 is this some library we should update in the future ? I recall I may have had trouble with older Time versions in relation with the BearSSL used for HTTPS under the ESP32.

3.2. SdFat

@atc1441 I recall you wanted to used the SPIFF filesystem in the future, wouldn't it be a prerequisite to get this up to the latest verison ?

3.3. BLEPeripheral

3.4. HRS3300lib

Library HRS3300-Arduino-Library has been declared precompiled: Precompiled library in "/home/username/Arduino/libraries/HRS3300-Arduino-Library/src/cortex-m4/fpv4-sp-d16-hard" not found Using precompiled library in /home/username/Arduino/libraries/HRS3300-Arduino-Library/src/cortex-m4 The plaform does not support 'compiler.libraries.ldflags' for precompiled libraries.

This can be fixed by adding the required compiler.libraries.ldflags and recipe.c.combine.pattern as noted in the ATCwatch repo Readme.md:

cd ~/.arduino15/packages/

Some more changes than the first two lines have been done to the D6Arduino.rar environment until now.

vi ~/.arduino15/packages/nRF52D6Fitness/hardware/nRF5/0.7.5/platform.txt

# Compile variables
# -----------------
compiler.libraries.ldflags=
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}"  "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{nrf.sdk.path}/components/toolchain/gcc/" "-L{nrf.sdk.path}/components/softdevice/{softdevice}/toolchain/armgcc/" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group
#***************************************************
# adafruit-nrfutil for uploading
# https://github.com/adafruit/Adafruit_nRF52_nrfutil
# pre-built binaries are provided for macos and windows
#***************************************************
tools.nrfutil.cmd=adafruit-nrfutil
tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/adafruit-nrfutil.exe
tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/adafruit-nrfutil
## Create dfu package zip file
recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --application-version 65535 --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
#
# OpenOCD sketch upload
#
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -f interface/{program.protocol}.cfg -c "{program.setup_command}" -f target/{upload.target}.cfg -c "init; halt; nrf51 mass_erase; flash write_bank 1 {{runtime.platform.path}/SoftDeviceFiles/dsd6-uicr.bin} 0; program {{{runtime.platform.path}/SoftDeviceFiles/dsd6-{flashVariantFile}}} verify reset; shutdown;"

The following warning is shown due to the binary only object code included in the library.

libheart.a(hrs3300_alg_dynamic.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
libheart.a(hrs3300_alg_bp.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

Despite these warnings the code compiles fine:

Library HRS3300-Arduino-Library has been declared precompiled:
Precompiled library in "/home/username/Arduino/libraries/HRS3300-Arduino-Library/src/cortex-m4/fpv4-sp-d16-hard" not found
Using precompiled library in /home/username/Arduino/libraries/HRS3300-Arduino-Library/src/cortex-m4
/home/username/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: /home/username/Arduino/libraries/HRS3300-Arduino-Library/src/cortex-m4/libheart.a(hrs3300_alg_dynamic.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/home/username/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: /home/username/Arduino/libraries/HRS3300-Arduino-Library/src/cortex-m4/libheart.a(hrs3300_alg_bp.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/home/username/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section i.Hrs3300_low_power by 2 bytes
/home/username/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ARM.exidx by 1 bytes
/home/username/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section i.Hrs3300_low_power by 2 bytes
/home/username/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ARM.exidx by 1 bytes
/home/username/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section i.Hrs3300_low_power by 2 bytes
/home/username/.arduino15/packages/nRF52D6Fitness/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ARM.exidx by 1 bytes
Sketch uses 356548 bytes (87%) of program storage space. Maximum is 409600 bytes.

3.5. lv_arduino

@atc1441 could we upgrade this to the 3.0.1 version keeping the changes below in mind ?

cd ~/Arduino/libraries
curl https://codeload.github.com/lvgl/lv_arduino/zip/refs/tags/2.1.5 -o lv_arduino-2.1.5.zip
unzip lv_arduino-2.1.5.zip

The lv_conf.h has to be adapted to the screen size of the D6 tracker or the P8 watch. Also some Font sizes and other options have to be enabled or set/unset. In fact LV_TICK_CUSTOM makes the LV_TICK_CUSTOM_INCLUDE change obsolete. The build also worked without commenting out the lv_conf_checker.h, I guess this is not necessary anymore.

vi lv_arduino-2.1.5/lv_conf.h

#define LV_HOR_RES_MAX          (240)
#define LV_COLOR_16_SWAP   1
#  define LV_MEM_SIZE    (6U * 1024U)
#define LV_USE_USER_DATA        0
#define LV_TICK_CUSTOM     0
--#define LV_TICK_CUSTOM_INCLUDE  "something.h"       /*Header for the sys time function*/
#define LV_USE_THEME_NIGHT      1   /*Dark elegant theme*/
#define LV_FONT_ROBOTO_12    1
#define LV_FONT_ROBOTO_22    1
#define LV_FONT_ROBOTO_28    1
#define LV_FONT_FMT_TXT_LARGE   1
#  define LV_BTN_INK_EFFECT   0
--#include "src/lv_conf_checker.h"
elazarrosenthal commented 2 years ago

Hi I'm a long time programmer but not an expert in Arduino I had made some changes for myself to the watch code but really wanted to work in Linux

I put together the script for myself and wanted to pass it back to @atc1441
I tried submitting via an issue but I kept updating so I mad the repo

@atc1441 would be the best to answer questions on library upgrades I'm just happy I can build in Linux

elazarrosenthal commented 2 years ago

one note on updating I attempted to upgrade to a new version of lvgl When I finaly got it to compile it was too big I figured out how do what I wanted in the old version

GitZero1 commented 2 years ago

this project and thread were very helpful for me to get this project set up using my own arduino ide on linux rather than the portable one on windows! thanks a bunch! I have also updated to the newest lvgl and can share my lv_conf.h if people are interested.

elazarrosenthal commented 2 years ago

@GitZero1 did you actually get the new version of lvgl to compile to a working executable, I tried and had to modify a lot of code to get it to work as things changed. also once I got it to compile i find teh resulting file was too big ( end of compile warning) I went back and worked with the old version and got what I wanted working.

I was just thinking if you got it working maybe wound up compiling both copies of the library into the binary or something.

GitZero1 commented 2 years ago

Yes its working. alongside the syntax changes you need to edit the lvgl config a bit. if you look in my fork i have a branch called updated lvgl testing or something along those lines. its not the "stock" atc firmware as I have made many changes but its only using about 55% of the available space (its defaulted to pinetime pinout so be careful to set that to whatever device youre using)

(sorry if this does not format properly. if youre in atcs discord I can share this file as a header file there) Here is my lv_conf

if you update lvgl and swap this config in, it should compile my update branch without issue. I would assume if you were to go thry the main branch and update all the syntax for lvgl it would fit. its still something im working on so over time I will add back more of the apps. this was just to be able to make an analog watch face

Edit hmm yea idk how to properly add code to comments! thats very long so I will remove it and try again sorry

I went ahead and just added the config file to the updated lvgl branch on my fork. should be available there now :)

stefan123t commented 2 years ago

@GitZero1 you may format the code block using the Github formatting tools <> or the markdown triple backticks before and after the block. Cheers

elazarrosenthal commented 2 years ago

Not sure if anyone is interested I started playing with one of these http://www.lilygo.cn/prod_view.aspx?TypeId=50053&Id=1290&FId=t3:50053:3

I bought form https://usa.banggood.com/ for around $43 in late December it arrived early February in New York prices are all over the plase if you look for it so shop around if you want you also might want to consider paying more for faster delivery

setup is described nicely here http://www.lilygo.cn/prod_view.aspx?TypeId=50053&Id=1290&FId=t3:50053:3

I got the LILYGO T-WATCH-2020 V2 because I wanted the GPS for what I want I want the ability to not rely on internet or other devices and that lets me get time and location

I made a lilygo branch and put a rudimentary setup script that builds the GPS example program here (using the command line stuff) https://github.com/elazarrosenthal/AtcWatchBuilder/blob/lilygo/setuplilygo

Things I like about it over p8 more memory more devices gps or sound sd card wifi nice case metal (top back is snap on plastic) - looks like a watch not a pc board strapped to your wrist normal USB connection for charging and programming no special cables no opening watch (the back snaps off but no special connection needed

things p8 is better on size smaller lilygo is on the big size sealed - snap on back on lilygo has holes in it probably would get water damaged if splashed while washing your hands cost - somewhat cheaper but added battery life - lilygo is not supposed to last that long from what I have read did not really use to tell for myself