Coder Social home page Coder Social logo

bcu's Issues

Build bcu under Mac OS (M1 silicon)

If you failed to build bcu under Mac M1, then you probably meet OpenSSL version issue. Normally brew use OpenSSL@3 as default, but bcu requires 1.1. To fix this:

brew install [email protected]
export PKG_CONFIG_PATH=/opt/Cellar/openssl\@1.1/1.1.1q/lib/pkgconfig
export LIBOPENSSL_PREFIX=/opt/Cellar/openssl\@1.1/1.1.1q

Remove the libssh2 and curl executable boot from CMakelist of libcurl:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a1333397..c04e44264 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,7 +73,7 @@ include_directories(${CURL_SOURCE_DIR}/include)

 option(CURL_WERROR "Turn compiler warnings into errors" OFF)
 option(PICKY_COMPILER "Enable picky compiler options" ON)
-option(BUILD_CURL_EXE "Set to ON to build curl executable." ON)
+option(BUILD_CURL_EXE "Set to ON to build curl executable." OFF)
 option(BUILD_SHARED_LIBS "Build shared libraries" ON)
 option(ENABLE_ARES "Set to ON to enable c-ares support" OFF)
 if(WIN32)
@@ -639,7 +639,7 @@ if(CURL_BROTLI)
 endif()

 #libSSH2
-option(CMAKE_USE_LIBSSH2 "Use libSSH2" ON)
+option(CMAKE_USE_LIBSSH2 "Use libSSH2" OFF)
 mark_as_advanced(CMAKE_USE_LIBSSH2)
 set(USE_LIBSSH2 OFF)
 set(HAVE_LIBSSH2 OFF)

After that, do:

cmake .
./build_libs_mac.sh
make

Buffer overflow in writeConf()

the function writeConf uses the local variable 'char text[255]' to prepare lines for writing to bcu_config.yaml

However the power group data that is processed from board.c includes this

    {"GROUP_SOC_FULL",      "nvcc_snvs_1v8,vdd_snvs_0v8,vdd_soc,vdd_pll_ana_0v8,vdd_pci_0v8,vdd_usb_0v8,vdd_vpu,vdd_gpu,vdd_dram,vdd_dram_pll_0v8,vdd_phy_0v9,vdd_arm,vdd_pll_ana_1v8,vdd_usb_1v8,vdd_pci_1v8,vdd_mipi_1v8,nvcc_dram_1v1,vdd_usb_3v3,vdd_phy_1v2,cpu_vdd_1v8,nvcc_sd1,nvcc_sd2,nvcc_enet,cpu_vdd_3v3"},

This group_string field is 287 characters long, in addition to the characters that added formatting in the sprintf operation overflows the 'text' variable on this line:
sprintf(text, ""%s"\n", board->power_groups[i].group_string);

This causes a buffer overflow and crash with some build environments.
Recommend increasing the 'char text[255]' to be 512 (or larger).

Reduce reliance on vendored libraries (libcurl, libyaml, libftdi)

Hi,

I would like to package bcu for meta-lxatac linux-automation/meta-lxatac#93 (a Yocto based operating system for the LXA TAC, an embedded linux development tool - but I digress the details don't matter too much here).

It would be great for packaging if bcu did not use vendored (as in git submodules) libcurl and libyaml and would instead use the libcurl and libyaml provided by the operating system.

I tried to prepare a pull request that does that, but quickly noticed that I do not know how to do this correctly for macOS and Windows builds, so I decided against doing that and to instead open this issue so someone with more macOS and Windows building experience can hopefully take over.
I also noticed that CMakeLists.txt also contains references to ${PROJECT_SOURCE_DIR}/libftdi/src which does not seem to exist (anymore?).

Issue setting bootmode for imx95evk

I am working with an imx95 (board IMX95LPD5BB-19 REV A) and I have issues using bcu to change the boot mode of the board.

Note: other functionalities of bcu seems ok: monitoring, eeprom....
Note2: jira ref: NXP_JIRA SRFTF-872

Test

wget NXP_NEXUS imx-boot-imx95-19x19-lpddr5-evk-sd.bin-flash_all

sudo /opt/Programs/UUU/uuu_1.5.141/uuu -b spl imx-boot-imx95-19x19-lpddr5-evk-sd.bin-flash_all

 $ /opt/Programs/BCU/bcu_1.1.75/bcu -h
version bcu_1.1.75-0-ge3f9a83
Usage:
bcu command [-options]

list of available commands:
        reset  [BOOTMODE_NAME] [-hold=] [-board=/-auto] [-id=]      reset the board, and then boot from BOOTMODE_NAME
               [-boothex=] [-bootbin=]                              or the boot mode value set by [-boothex=] [-bootbin=]
        onoff  [-hold=] [-board=/-auto] [-id=]                      press the ON/OFF button once for -hold= time(ms)
        init   [BOOTMODE_NAME] [-board=/-auto] [-id=]               enable the remote control with a boot mode
        deinit [BOOTMODE_NAME] [-board=/-auto] [-id=]               disable the remote control

        monitor [-board=/-auto] [-id=]                              monitor power consumption
                [-dump/-dump=] [-nodisplay] [-pmt] [-stats]
                [-hz=] [-rms]
                [-hwfilter] [-unipolar]
                [-temp]

        server  [-board=/-auto] [-id=]                              monitor power consumption
                [-hwfilter] [-unipolar]

        eeprom  [-w] [-r] [-erase]                                  EEPROM read and program
                [-wsn=] [-brev=] [-srev=]

        temp    [-board=/-auto] [-id=]                              Get temperature value
        get_level [GPIO_NAME] [-board=/-auto] [-id=]                get level state of pin GPIO_NAME
        set_gpio [GPIO_NAME] [1/0] [-board=/-auto] [-id=]           set pin GPIO_NAME to be high(1) or low(0)
        set_boot_mode [BOOTMODE_NAME] [-board=/-auto] [-id=]        set BOOTMODE_NAME as boot mode
                      [-boothex=] [-bootbin=]
        get_boot_mode [-board=/-auto] [-id=]                        read the boot mode set by BCU before

        lsftdi                                                      list all boards connected by ftdi device
        lsboard                                                     list all supported board models
        lsbootmode [-board=/-auto]                                  show a list of available BOOTMODE_NAME of a board
        lsgpio     [-board=/-auto]                                  show a list of available GPIO_NAME of a board

        upgrade    [-doc] [-f] [-pre]                               get the latest BCU release
        uuu        [-doc]                                           download the latest UUU

        version                                                     print version number
        -h,  help                                                   show command details
        -cp, conf_path                                              show config file path

 $ sudo /opt/Programs/UUU/uuu_1.5.141/uuu -lsusb
uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.5.141-0-gde317f5

Connected Known USB Devices
        Path     Chip    Pro     Vid     Pid     BcdVersion
        ==================================================
        1:101    MX95    SDPS:   0x1FC9 0x015D   0x0001

		
 $ /opt/Programs/BCU/bcu_1.1.75/bcu lsftdi
version bcu_1.1.75-0-ge3f9a83
number of boards connected through FTDI device found: 1
board[0] location_id=1-7 serial_no:
done

 $ /opt/Programs/BCU/bcu_1.1.75/bcu get_boot_mode -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19
ftdi_read_eeprom: -2 (USB device unavailable)
This board support EEPROM but it is EMPTY.
Please use below command to program the EEPROM.

 $ sudo /opt/Programs/BCU/bcu_1.1.75/bcu eeprom -w -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19

>>>>>> Registered FTDI EEPROM on board >>>>>>
Write imx95evk19 default values to FTDI EEPROM successfully

FTDI EEPROM SN: 654CB0
Board Info: NXP i.MX95 EVK 19x19 Board Rev A0
  SoC Info: i.MX95 Rev A0
 PMIC Info: PPF0900AMBA1ES
Number of available power rails: 16
Serial Number: 1

done

 $ sudo /opt/Programs/BCU/bcu_1.1.75/bcu get_boot_mode -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19
get_boot_mode hex value: 0x40, cannot find the boot mode string.
done

 $ sudo /opt/Programs/BCU/bcu_1.1.75/bcu lsbootmode -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19

available boot mode:

        a_usb
        a_emmc
        a_sd
        a_nor
        a_nand_2k
        a_nand_4k
        usb
        emmc
        sd
        nor
        nand_2k
        nand_4k
done

 $ sudo /opt/Programs/BCU/bcu_1.1.75/bcu init usb -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19
set ft_sd_pwren high successfully
set ft_sd_cd high successfully
set mode_dir high successfully
ENABLE remote control
set onoff low successfully
set reset low successfully
set boot mode successfully
board initialization finished
done

 $ sudo /opt/Programs/BCU/bcu_1.1.75/bcu set_boot_mode usb -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19
set boot mode successfully
done

 $ sudo /opt/Programs/BCU/bcu_1.1.75/bcu get_boot_mode -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19
get_boot_mode hex value: 0x40, cannot find the boot mode string.
done

 $ sudo /opt/Programs/BCU/bcu_1.1.75/bcu set_boot_mode emmc -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19
set boot mode successfully
done

 $ sudo /opt/Programs/BCU/bcu_1.1.75/bcu get_boot_mode -board=imx95evk19
version bcu_1.1.75-0-ge3f9a83
board model is imx95evk19
get_boot_mode hex value: 0x40, cannot find the boot mode string.
done

Important bit:

  • whatever the boot_mode setted in the last commands, get_boot_mode always return the same value.

Investigation

BCU was reporting that it could not find the string corresponding to the hex values so I tried to change the mapping in the bcu source code with floowing patch:

diff --git a/board.c b/board.c
index 146bd19..3637f17 100644
--- a/board.c
+++ b/board.c
@@ -1057,9 +1057,9 @@ struct boot_mode imx95evk_board_boot_modes[] = {
        {"a_nor", 0x04},
        {"a_nand_2k", 0x05},
        {"a_nand_4k", 0x06},
-       {"usb", 0x09},
-       {"emmc", 0x0a},
-       {"sd", 0x0b},
+       {"usb", 0x40},
+       {"emmc", 0x60},
+       {"sd", 0x70},
        {"nor", 0x0c},
        {"nand_2k", 0x0d},
        {"nand_4k", 0x0e},

=> It did not fix the issue

[Windows] BCU erroneously shows multiple boards when a serial connection is open.

Platform: Windows 11
Boards tested: IMX8ULP
BCU version: bcu_1.1.52-0-g17ab144
FTDI Driver Version: 2.12.36.4

Steps to reproduce:

  1. Connect board FTDI interface to host PC.
  2. Verify that the expected "USB Serial Port" devices show up in device manager. (4 for the 8ULP)

image

  1. Run bcu lsftdi. Only one board is detected, as expected:

image

  1. Open any of the serial devices in any serial console software (Putty, CoolTerm, etc.)
  2. Re-run bcu lsftdi, 2 boards show up now:

image

On the 8ULP, connecting to the first detected COM port (COM15 in this case) causes BCU to fail fetching the location_id:
image

bcu_mac can run on Apple Silicon in arm64 mode

Hi,

The documentation on the repo states that you must put your terminal into x86_64 mode if you want to run bcu_mac on an M1/M2 Mac.

I got it to work without doing that - my terminal is running in arm64 mode.

To do this, simply follow these steps:

  1. Install packages through brew as normal.
  2. Clone the repo with --recursive
  3. Run cmake . as normal.
  4. Run make
  5. You will see that it complains about not being able to find libssl.1.1.dylib. Run the following two commands for libel and lib crypto:
  6. cd /opt/homebrew/Cellar/openssl@3/3.0.8/lib/
  7. ln -s libssl.dylib libssl.1.1.dylib
  8. ln -s libcrypto.dylib libcrypto.1.1.dylib

Then try running make again. Once it successfully builds, copy the "bcu_mac" binary to /opt/homebrew/bin.

Here is a screenshot of it running in my terminal on arm64:
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.