Share message counting logic in code generator.
Share message counting logic in code generator.

mgiannikouris/vi-firmware,ene-ilies/vi-firmware,ene-ilies/vi-firmware,ene-ilies/vi-firmware,ene-ilies/vi-firmware,openxc/vi-firmware,mgiannikouris/vi-firmware,openxc/vi-firmware,openxc/vi-firmware,mgiannikouris/vi-firmware,openxc/vi-firmware,mgiannikouris/vi-firmware