dronecan / libcanard

MIT License
45 stars 52 forks source link

Pr 16bit addressing support #33

Closed viorz closed 10 months ago

viorz commented 1 year ago

TMS320 have 16-bits addressing, so

  1. (uint8_t) same (uint16_t)
  2. sizeof(float) is 2
  3. union not same like STM32, because type uint8_t does not exist in hardware

Example: union { uint64_t u8; uint64_t u16; uint64_t u32; uint64_t u64; uint8_t bytes[8]; } storage;

 address:|   bytes:        |   u64:                      |   u32:                       |   u16:    |   u8:
 0x00      |   bytes[0]    |   (u64         )&0xFF  |   (u32         )&0xFF  |   u16     |   u8
 0x01      |   bytes[1]    |   (u64>>16)&0xFF  |   (u32>>16)&0xFF  |
 0x02      |   bytes[2]    |   (u64>>32)&0xFF  |
 0x03      |   bytes[3]    |   (u64>>48)&0xFF  |
 0x04      |   bytes[4]    |
 0x05      |   bytes[5]    |
 0x06      |   bytes[6]    |
 0x07      |   bytes[7]    |
tridge commented 1 year ago

@viorz thanks for the contribution! what testing have you done on this?

tridge commented 1 year ago

I've pushed some fixes to try to get CI to pass

tridge commented 1 year ago

@viorz it now builds and passes tests, but please let me know what testing you have done so I can be sure it really works

tridge commented 1 year ago

@viorz any update?

EMBRMP2 commented 1 year ago

@viorz have you tested this commit with any TMS320 microcontroller

tridge commented 10 months ago

I believe this will work, and will merge, hopefully someone with this type of MCU will test

viorz commented 9 months ago

I tested it on TMS320F280049 and it work.