> AVR-GCC has a NVM_PROD_SIGNATURES_t which contains all the registers of the
> production signature row. However, when loading from the signature row, you
> need the offset.

I don't see this change as needed, use 'offsetof' in stddef.h:

Here is a snippet of my code that I use to display all of the
NVM_PROD_SIGNATURES on one of my screens:

  /* XMega serial number: */
  (void) SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
LOTNUM0 ) ); /* First read after reset or possibly Power Up returns
zero, so read then toss this value */

  hex_out_buffer( SP_ReadCalibrationByte( offsetof(
NVM_PROD_SIGNATURES_t, LOTNUM0 ) ) );
  hex_out_buffer( SP_ReadCalibrationByte( offsetof(
NVM_PROD_SIGNATURES_t, LOTNUM1 ) ) );
  hex_out_buffer( SP_ReadCalibrationByte( offsetof(
NVM_PROD_SIGNATURES_t, LOTNUM2 ) ) );
  hex_out_buffer( SP_ReadCalibrationByte( offsetof(
NVM_PROD_SIGNATURES_t, LOTNUM3 ) ) );
  hex_out_buffer( SP_ReadCalibrationByte( offsetof(
NVM_PROD_SIGNATURES_t, LOTNUM4 ) ) );
  hex_out_buffer( SP_ReadCalibrationByte( offsetof(
NVM_PROD_SIGNATURES_t, LOTNUM5 ) ) );
  hex_out_buffer( (uint8_t) ' ' );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, WAFNUM ) )  );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, COORDX0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, COORDX1 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, COORDY0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, COORDY1 ) ) );
  hex_out_buffer( (uint8_t) ' ' );

  lcd_text(SCRN_LEFT,  SCRN_TOP+13, FONT_FIVE_DOT, (char *) hex_buffer_u8);
  hex_buf_ptr_u8 = hex_buffer_u8;

  /* Analog Calibrations: */
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
TEMPSENSE0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
TEMPSENSE1 ) ) );
  hex_out_buffer( (uint8_t) ' ' );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, ADCACAL0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, ADCACAL1 ) ) );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, ADCBCAL0 ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t, ADCBCAL1 ) ) );
  hex_out_buffer( (uint8_t) ' ' );

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACAOFFCAL ) ) );
#if( __GCC_VERSION__ < 433 ) /* Version prior to 4.3.3 had the name
wrote (C vs G): */
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACACAINCAL ) ) );
#else
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACAGAINCAL ) ) );
#endif

  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACBOFFCAL ) ) );
  hex8( SP_ReadCalibrationByte( offsetof( NVM_PROD_SIGNATURES_t,
DACBGAINCAL ) ) );

  lcd_text(SCRN_LEFT,  SCRN_TOP+19, FONT_FIVE_DOT, (char *) hex_buffer_u8);

_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to