You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Amr Bekhit <am...@gmail.com> on 2018/06/25 12:48:58 UTC

Retrieving hardware IDs in Mynewt

Hello,

Is there any driver for retrieving CPU hardware IDs in mynewt? I can see
that there is a sys/id package, but I couldn't find any documentation for
it, nor any use of this library in the sample code.

Amr

Re: Retrieving hardware IDs in Mynewt

Posted by Fabio Utzig <ut...@apache.org>.
Hello,

You can simply call the HAL routine, given you already know the size of the HWID for your MCU (using LEN below):

#include <hal/hal_bsp.h>

uint8_t buf[LEN];

len_read = hal_bsp_hw_id(buf, LEN);

"buf" will have the HWID and the len will be returned. If you want to do it in a portable manner, you can use hal_bsp_hw_id_len() to check the size for the target MCU and allocate enough space (that was added recently, so not available on older releases).

Fabio

On Mon, Jun 25, 2018, at 9:48 AM, Amr Bekhit wrote:
> Hello,
> 
> Is there any driver for retrieving CPU hardware IDs in mynewt? I can see
> that there is a sys/id package, but I couldn't find any documentation for
> it, nor any use of this library in the sample code.
> 
> Amr