Doc comments for hal and lib.

Just leaves `drivers` (and `platformtree`) to go.