cn-uofbasel / ccn-lite

CCN-lite, a lightweight implementation of the CCNx protocol and its variations
ISC License
74 stars 63 forks source link

Add to documentation: 8-Bit not supported #199

Open Citrullin opened 6 years ago

Citrullin commented 6 years ago

I used a RIOT OS example, which uses CCN Lite as library. Some errors occurred. I fixed them line by line. Mostly unsigned Int and signed Int comparison. I reached a point where I got the following error:

ccnl-pkt-ccntlv.c:508:5: error: left shift count >= width of type [-Werror]

Since I use an AVR 8-Bit processor, shifting 16-Bit on an int isn't possible. I recommend to just add this somewhere in the documentation. So that people know that 8-Bit MCUs are not supported at the moment. :)

The RIOT OS issue: https://github.com/RIOT-OS/RIOT/issues/8598

cgundogan commented 6 years ago

@Citrullin thanks for reporting this!

Since I use an AVR 8-Bit processor, shifting 16-Bit isn't possible.

In general, shifting by 16 bits is not impossible for an 8bit architecture. The compiler just assumes an (8bit) integer type as a result of that shift. Casting the numbers to an integer with a width greater than 16 should suffice. I can provide a patch for this.

I assume you use RIOT. We will also provide a version bump of the CCN-lite package in RIOT, because there were some important changes in the RIOT adapter of CCN-lite.

Citrullin commented 6 years ago

@cgundogan I know that there are strategies for working with 16-Bits and more on 8-Bit MCUs :) It was just a recommendation for now. So, that other people are not frustrated by working with RIOT and therefore with CCN Lite on a 8-Bit MCU. I think the adaption for 8-Bit MCUs could take more time than writing a short notice :D

I will try the whole RIOT features on a 32-Bit MCU, for now. There are also other errors. I take a look into it and will fix them in the future. :) I'll create some pull requests for it.

mfrey commented 6 years ago

Are you going through RIOTs code/packages and check if it really builds for 8 bit or are you considering to use CCN-lite on an 8 bit architecture?

Citrullin commented 6 years ago

@mfrey RIOT is build for 8 bit. I already used the shell on an ATMega328P. :) I got a CC1101 module. I want to create a network with it. So, I researched a bit and found the concept of content centric network. I consider using it for IOTA payments on embedded devices. Since I don't care about where I get the information (let's say the balance of an account), this seems to be a good use case for CCN. But still: I need to read more, getting into the specifications, the code etc. That's my current status. So, that's why 32-Bit for now is also reasonable for me. I ordered already some STM32 MCUs. :) But I thought a short notice would be nice for people who are getting into C and RIOT/CCN. Actually I'm also not a regular C embedded developer. I mainly use Scala and Javascript in my commercial work. I'm a junior in C :D

I don't know if I will use it on 8 bit MCUs. At the moment: I consider it. Depends on the use case. I even don't know if a 8 bit MCU is powerful enough for some hashing algorithms. There a few people who already tried hashing on 8 bit MCUs. Seems to be slow. But the speed could be fine for some use cases.

mfrey commented 6 years ago

Sounds interesting. Let me know if you're up for a 🍺 in Berlin. There are few challenges with cryptographic operations and ccn-lite

Citrullin commented 6 years ago

@mfrey Of course :) Just write me on twitter or facebook. Same username as here :)