You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by "paul@wrada.com" <pa...@wrada.com> on 2016/04/19 22:12:28 UTC

test tool

I'm going to spend time working on the hardware HAL test tool, making the following changes

  1.  move it to its own repo on github  mynewt-xxx.
  2.  Give it a new name. I was thinking I would name the tool cinch or nippy. Would love feedback.  Wanted it to sound simple and useful
  3.  Add better support for serial protocols.  I think to do this I need to refactor the API and make specific APIs for each device.
  4.  Platform independence (see below). Be able to compile with any device with minimal configuration (like which hals are available)

To make this platform independent (which should be possible if not easy). I need a way to be able to enumerate the sys_ids in the system, show them in the UI and parse them as friendly strings or numbers (not strictly necessary, but it would not be a cinch if it didn't do this).

Right now the ids for a specific BSP are stored in

Bsp/sysid.h

enum system_device_id
{
AIN0=33,
AIN1=22,
SPI0=1,
PWM0=13,
};

But what I need is a way to show the available sys ids and give them names for a UI.  This hints at ugly marco stuff like this, which generally I hate, but in this case would allow me to do what I want, at the expense of making the bsp_sysid file a bit complicated looking.    Can folks comment on this type of macro stuff.  Its better than a fixed mapping as systems that don't need to look up or enumerate devices won't create the array (code space)


#define sysids_list(f) \
        f(AIN0, 33)     \
        f(AIN1, 22)     \
        f(SPI0, 1)      \
        f(PWM0, 13)     \
        ...

#define f_enum(x,y)     x=y,
#define f_arr(x,y)      {x, y},

enum system_device_id { sysid_list(f_enum) };


And then in my test code I could do a mapping like this

static const struct {enum system_device_id; char *str; } map = { sysid_list(f_arr) };