lupyuen / lupyuen.github.io

Lup Yuen's Articles and Resume
https://lupyuen.github.io
Apache License 2.0
72 stars 15 forks source link

bsp-files-per-project #9

Closed ntn888 closed 2 years ago

ntn888 commented 2 years ago

Hi! How are you doing?

Lately i've picked up the bl702 and become sort of fan on this chip, i think it's quite versatile...

I'm trying to study the native iot_sdk with it's new Hosal HAL. Given that it's based off just plain Makefiles it's easy to follow for noob like me... Also the bl702 is not supported by Nuttx I think.

Anyway... I found that the sdk's BSP files are in components/platform/soc/bl702/bl702_std/BSP_Board/bl702_evb. And wanted to know if it's possible to over-ride these files locally in a per-project basis?

There is also the online intuitive GUI tool to generate these files (https://dev.bouffalolab.com/media/config/index.html). But still where to place these files?

lupyuen commented 2 years ago

Hi I'm good :-) I don't think it's a good idea to override files in bl702_std, that's the BL702 Standard Driver that's called by the BL702 HAL. The HAL and Standard Driver should never be changed, because it might cause issues for other folks who will build and run your app.

What changes were you planning to make to bl702_std?

ntn888 commented 2 years ago

I see, I think I've misunderstood the setup.

But even if that is the case... this pinmux file doesnt setup the pins for peripherals like SPI: https://github.com/bouffalolab/bl_iot_sdk/blob/master/components/platform/soc/bl702/bl702_std/BSP_Board/bl702_evb/pinmux_config.h

don't i need to modify this file if i'm using the SPI? it's currently all set to GPIO_FUN_UNUSED execpt for the UART?

lupyuen commented 2 years ago

Sorry I haven't used the new "hosal" HAL, so I might be wrong, but here's what I think...

If we're using SPI on BL706 we should configure the pins in our app like this...

https://github.com/bouffalolab/bl_iot_sdk/blob/master/customer_app/peripheral/demo_spi/demo_spi/demo_spi_master.c#L57-L62

    spi.config.pin_clk = 3;
    /* hardware cs now is pin 2 */
    spi.config.pin_mosi= 0;
    spi.config.pin_miso= 1;
    /* init spi device */
    hosal_spi_init(&spi);

With the Old HAL we define the SPI Pins in the Device Tree. With the New "hosal" HAL, I think the SPI Pins have been moved into the app.

ntn888 commented 2 years ago

Ah I see. I'll try it out... thanks a lot for your pointer...

the place for generated files from the GUI tool is still a mystery