Differences between the old and new versions of Chibios

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
blackberryer
Posts: 24
Joined: Sat Apr 05, 2025 6:52 pm
Been thanked: 4 times

Differences between the old and new versions of Chibios

Post by blackberryer »

I just ported to the latest chibios version and have documented a lot of diffs, like the one below,I simply set the ‘_base_object_methods’ to 0, will there be a problem

Code: Select all

#define _base_sequential_stream_methods                                     \
  /* Stream write buffer method.*/                                          \
  size_t (*write)(void *instance, const uint8_t *bp, size_t n);             \
  /* Stream read buffer method.*/                                           \
  size_t (*read)(void *instance, uint8_t *bp, size_t n);                    \
  /* Channel put method, blocking.*/                                        \
  msg_t (*put)(void *instance, uint8_t b);                                  \
  /* Channel get method, blocking.*/                                        \
  msg_t (*get)(void *instance);                                             \


Code: Select all

#define _base_sequential_stream_methods                                     \
  _base_object_methods                                                      \
  /* Stream write buffer method.*/                                          \
  size_t (*write)(void *instance, const uint8_t *bp, size_t n);             \
  /* Stream read buffer method.*/                                           \
  size_t (*read)(void *instance, uint8_t *bp, size_t n);                    \
  /* Channel put method, blocking.*/                                        \
  msg_t (*put)(void *instance, uint8_t b);                                  \
  /* Channel get method, blocking.*/                                        \
  msg_t (*get)(void *instance);
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Differences between the old and new versions of Chibios

Post by Giovanni »

Hi,

Not enough information, where do you have a problem with changes?

Giovanni
blackberryer
Posts: 24
Joined: Sat Apr 05, 2025 6:52 pm
Been thanked: 4 times

Re: Differences between the old and new versions of Chibios

Post by blackberryer »

Giovanni wrote:Hi,

Not enough information, where do you have a problem with changes?

Giovanni


Because when I was porting F405, it took a lot of time, and I couldn't compile it properly;
So I switched to the new version of chibios, and finally it was successfully compiled, and the basic functions were implemented, but the I2S data was received incorrectly;
So I tried to test the new version of chibios with F303, and I2S also received unsuccessfully;

One thing that is certain: the F303 has fine I2S data on older versions of chibios;

So I'm comparing the differences between the old and new versions now to see if I can solve the problem of I2S data receiving errors
blackberryer
Posts: 24
Joined: Sat Apr 05, 2025 6:52 pm
Been thanked: 4 times

Re: Differences between the old and new versions of Chibios

Post by blackberryer »

Giovanni wrote:Hi,

Not enough information, where do you have a problem with changes?

Giovanni


Or see if I can fix the F405 compilation error on older versions, here's the error I reported when compiling older versions


Code: Select all

ChibiOS/os/hal/src/hal_serial_usb.c: In function 'sduRequestsHook':
ChibiOS/os/hal/src/hal_serial_usb.c:323:19: error: request for member 'bmRequestType' in something not a structure or union
  323 |   if ((usbp->setup.bmRequestType & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_CLASS) {
      |                   ^
ChibiOS/os/hal/src/hal_serial_usb.c:324:24: error: request for member 'bRequest' in something not a structure or union
  324 |     switch (usbp->setup.bRequest) {
      |                        ^
make: *** [ChibiOS/os/common/startup/ARMCMx/compilers/GCC/rules.mk:216: build/obj/hal_serial_usb.o] Error 1



Looking at the error it seems to be connected to USBv1 and the F405 should be using OTGv1,I'm confused by this error and don't know how to fix it
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Differences between the old and new versions of Chibios

Post by Giovanni »

Hi,

The F4 uses OTGv1

Code: Select all

# Drivers compatible with the platform.
include $(CHIBIOS)/os/hal/ports/STM32/LLD/ADCv2/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/CANv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/CRYPv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/DACv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/DMAv2/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/EXTIv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/GPIOv2/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/I2Cv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/MACv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/OTGv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/QUADSPIv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/RTCv2/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/SPIv1/driver_v2.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/SDIOv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/SYSTICKv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/TIMv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/USARTv1/driver.mk
include $(CHIBIOS)/os/hal/ports/STM32/LLD/xWDGv1/driver.mk


Are you using custom build files? you should explain your setup or it is impossible to try to help.

Giovanni
blackberryer
Posts: 24
Joined: Sat Apr 05, 2025 6:52 pm
Been thanked: 4 times

Re: Differences between the old and new versions of Chibios

Post by blackberryer »

Just now, I disabled USB, successfully compiled the old version, it runs successfully on F405, I2S data is fine,and i confirmed the compilation option, it's OTGv1

Code: Select all

Compiler Options
arm-none-eabi-gcc -c -mcpu=cortex-m4 -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -ffast-math -fsingle-precision-constant -ffunction-sections -fdata-sections -fno-common -flto -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wall -Wextra -Wundef -Wstrict-prototypes -Wa,-alms=build/lst/ -DCORTEX_USE_FPU=TRUE -DARM_MATH_CM4 -DVERSION="" -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF .dep/build.d -I. -IChibiOS/os/license -IChibiOS/os/common/startup/ARMCMx/compilers/GCC -IChibiOS/os/common/startup/ARMCMx/devices/STM32F4xx -IChibiOS/os/common/ext/CMSIS/include -IChibiOS/os/common/ext/CMSIS/ST/STM32F4xx -IChibiOS/os/rt/include -IChibiOS/os/common/oslib/include -IChibiOS/os/common/ports/ARMCMx -IChibiOS/os/common/ports/ARMCMx/compilers/GCC -IChibiOS/os/hal/osal/rt -IChibiOS/os/hal/include -IChibiOS/os/hal/ports/common/ARMCMx -IChibiOS/os/hal/ports/STM32/STM32F4xx -IChibiOS/os/hal/ports/STM32/LLD/ADCv2 -IChibiOS/os/hal/ports/STM32/LLD/CANv1 -IChibiOS/os/hal/ports/STM32/LLD/DACv1 -IChibiOS/os/hal/ports/STM32/LLD/DMAv2 -IChibiOS/os/hal/ports/STM32/LLD/EXTIv1 -IChibiOS/os/hal/ports/STM32/LLD/GPIOv2 -IChibiOS/os/hal/ports/STM32/LLD/I2Cv1 -IChibiOS/os/hal/ports/STM32/LLD/MACv1 -IChibiOS/os/hal/ports/STM32/LLD/OTGv1 -IChibiOS/os/hal/ports/STM32/LLD/RTCv2 -IChibiOS/os/hal/ports/STM32/LLD/SDIOv1 -IChibiOS/os/hal/ports/STM32/LLD/SPIv1 -IChibiOS/os/hal/ports/STM32/LLD/TIMv1 -IChibiOS/os/hal/ports/STM32/LLD/USARTv1 -IChibiOS/os/hal/ports/STM32/LLD/xWDGv1 -IChibiOS/os/hal/lib/streams main.c -o main.o


but I'm currently using the code of the old version of CHIBOS, I can't use OTGv1

One difference I see between the old and the new is USBDriver :

old version

Code: Select all

bool sduRequestsHook(USBDriver *usbp) {

  if ((usbp->setup.bmRequestType & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_CLASS) {
    switch (usbp->setup.bRequest) {
    case CDC_GET_LINE_CODING:
      usbSetupTransfer(usbp, (uint8_t *)&linecoding, sizeof(linecoding), NULL);
      return true;
    case CDC_SET_LINE_CODING:
      usbSetupTransfer(usbp, (uint8_t *)&linecoding, sizeof(linecoding), NULL);
      return true;
    case CDC_SET_CONTROL_LINE_STATE:
      /* Nothing to do, there are no control lines.*/
      usbSetupTransfer(usbp, NULL, 0, NULL);
      return true;
    default:
      return false;
    }
  }
  return false;
}


lastet version

Code: Select all

bool sduRequestsHook(USBDriver *usbp) {

  if ((usbp->setup[0] & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_CLASS) {
    switch (usbp->setup[1]) {
    case CDC_GET_LINE_CODING:
      usbSetupTransfer(usbp, (uint8_t *)&linecoding, sizeof(linecoding), NULL);
      return true;
    case CDC_SET_LINE_CODING:
      usbSetupTransfer(usbp, (uint8_t *)&linecoding, sizeof(linecoding), NULL);
      return true;
    case CDC_SET_CONTROL_LINE_STATE:
      /* Nothing to do, there are no control lines.*/
      usbSetupTransfer(usbp, NULL, 0, NULL);
      return true;
    default:
      return false;
    }
  }
  return false;
}
blackberryer
Posts: 24
Joined: Sat Apr 05, 2025 6:52 pm
Been thanked: 4 times

Re: Differences between the old and new versions of Chibios

Post by blackberryer »

it's a lot of work to compare the differences between the whole version, so,just now I switched to a chibios version, and everything is still working fine at the moment, temporarily solving the problem
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Differences between the old and new versions of Chibios

Post by Giovanni »

Hi,

You should align to newer versions, it is hard to keep track of all changes over the year, it can be done but it takes time.

Giovanni
blackberryer
Posts: 24
Joined: Sat Apr 05, 2025 6:52 pm
Been thanked: 4 times

Re: Differences between the old and new versions of Chibios

Post by blackberryer »

Giovanni wrote:Hi,

You should align to newer versions, it is hard to keep track of all changes over the year, it can be done but it takes time.

Giovanni


I'm using an older version for the time being and migrating to the latest version once the issue is resolved

Now I notice that sdSetBaudrate is missing, what did it change to?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Differences between the old and new versions of Chibios

Post by Giovanni »

Hi,

It never had such a function, you are probably using some customized driver.

Giovanni
Post Reply