HAL Driver - Device OS b5som


I am hoping to get some guidance on implementing a HAL driver for the b5som. I intend to add an SPI based CAN driver to the b5som device OS build. To start off I am attempting to simply add an “empty” can_hal.cpp (form template) + slight modification of can_hal.h such that the application code can compile and run using the CANChannel class. I have however gotten into a state where using the CANChannel Class now causes an SOS hardfault.

What I have done so far

  1. Added can_hal.cpp source file to nRF hal src.
  2. added hal_dynalib_can.h to dynalib export header in nRF hal src
  3. modified hal_duynalib_can.h to not exclude the nRF chip.
  4. added PROVIDE ( dynalib_location_hal_can = system_part1_module_table + 116 ); to module export linker file.

All of this has let me build the application code but it hardfaults on the instantiation of the CANChannel class. possibly a linker issue?

Thanks in advance for any help.

Is there a particular reason you want to do it that way? It will be difficult to do, and you’ll forever be needing to maintain your custom fork of Device OS. It’s also hard to upgrade a fork of Device OS over-the-air later on.

The Tracker SoM and Tracker One have a CAN interface and they do it using a user firmware library, not a modified Device OS.

You make some valid points. Initially I thought it would be easier for the application developer when porting fromt he e-series. I hadn’t thought about the OTA upgrade implications. I will change tact and implement it in user code.