<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>STATIC_ASSERT and GCC (instead of Keil)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1355/static_assert-and-gcc-instead-of-keil</link><description>I&amp;#39;m bringing up ble_app_hrs as an eclipse project using gcc. 
 I&amp;#39;m running into an error in app_util.h, line 67: 
 #define STATIC_ASSERT(EXPR) typedef char static_assert_failed[(EXPR) ? 1 : -1] 
 The error is: 
 typedef &amp;#39;static_assert_failed&amp;#39; locally</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Feb 2025 16:39:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1355/static_assert-and-gcc-instead-of-keil" /><item><title>RE: STATIC_ASSERT and GCC (instead of Keil)</title><link>https://devzone.nordicsemi.com/thread/521381?ContentTypeID=1</link><pubDate>Tue, 04 Feb 2025 16:39:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af58c461-5dd8-49b7-bebb-8d168909a875</guid><dc:creator>leo73</dc:creator><description>&lt;p&gt;Hello to every one,&lt;/p&gt;
&lt;p&gt;i must compile some .c and .h file in a project, am using MPLAB-X-IDE 6.20 and avr gcc 7.3.0 (for program my ATMega644P mcu).&lt;/p&gt;
&lt;p&gt;the error up it seems like my errors, please can you rewrite for me this lines? thank you.&lt;/p&gt;
&lt;p&gt;Compiler is unable to compile follow lines:&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct SysTick_Regs, CALIB) == 0x1c - 0x10, &amp;quot;struct SysTick_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;give me error:&amp;nbsp;lpc17xx/lpc176x.h:62:42: error: &amp;quot;(&amp;quot; may not appear in macro parameter list&lt;br /&gt;make[2]: Entering directory &amp;#39;C:/Users/Leonardo/Documents/Elettronica 2014/Download Project/ATmega/C-64-SdCardDrive/sd2iec-MPlab/ds2iec-mega644pV1.0.0&amp;#39;&lt;br /&gt;&amp;quot;C:\Program Files (x86)\GNU Avr-8-bit toolchain\bin\avr-gcc.exe&amp;quot; -mmcu=atmega644p -I &amp;quot;C:/Program Files/Microchip/MPLABX/v6.20/packs/Microchip/ATmega_DFP/3.1.264/include&amp;quot; -B &amp;quot;C:/Program Files/Microchip/MPLABX/v6.20/packs/Microchip/ATmega_DFP/3.1.264/gcc/dev/atmega644p&amp;quot; -x c -c -D__ATmega644P__ -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF &amp;quot;build/default/production/lpc17xx/llfl-ar6.o.d&amp;quot; -MT &amp;quot;build/default/production/lpc17xx/llfl-ar6.o.d&amp;quot; -MT build/default/production/lpc17xx/llfl-ar6.o -o build/default/production/lpc17xx/llfl-ar6.o lpc17xx/llfl-ar6.c -DXPRJ_default=default &lt;br /&gt;make[2]: Leaving directory &amp;#39;C:/Users/Leonardo/Documents/Elettronica 2014/Download Project/ATmega/C-64-SdCardDrive/sd2iec-MPlab/ds2iec-mega644pV1.0.0&amp;#39;&lt;br /&gt; #define _Static_assert(__builtin_offsetof(struct SysTick_Regs, CALIB) == 0x1c - 0x10) typedef char static_assert_failed[(__builtin_offsetof(struct SysTick_Regs, CALIB) == 0x1c - 0x10) ? 1 : -1] __attribute__((unused))&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and so on (all errors):&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct SCB_Regs, BFAR) == 0x38, &amp;quot;struct SCB_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct NVIC_Regs, STIR) == 0xf00 - 0x100, &amp;quot;struct NVUC_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_GPDMA_Regs, DMACSync) == 0x34, &amp;quot;struct LPC_GPDMA_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_GPDMACH_Regs, DMACCConfig) == 0x10, &amp;quot;struct LPC_GPDMACH_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_GPIO_Regs, FIOCLR) == 0x1c, &amp;quot;struct LPC_GPIO_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_GPIOINT_Regs, IO2IntEnF) == 0xb4 - 0x80, &amp;quot;struct LPC_GPIOINT_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_I2C_Regs, I2MASK3) == 0x3c, &amp;quot;struct LPC-I2C_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_PINCON_Regs, I2CPADCFG) == 0x7c, &amp;quot;struct LPC_PINCON_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_RIT_Regs, RICOUNTER) == 0xc, &amp;quot;struct LPC_RIT_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_RTC_Regs, ALYEAR) == 0x7c, &amp;quot;struct LPC_RTC_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_SC_Regs, DMAREQSEL) == 0x1c4, &amp;quot;struct LPC_SC_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_SSP_Regs, DMACR) == 0x24, &amp;quot;struct LPC_SSP_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_TIMER_Regs, CTCR) == 0x70, &amp;quot;struct LPC_Timer_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_UART0_Regs, TER) == 0x30, &amp;quot;struct LPC_UART0_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_UART1_Regs, RS485DLY) == 0x54, &amp;quot;struct LPC_UART1_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;_Static_assert(__builtin_offsetof(struct LPC_WDT_Regs, WDCLKSEL) == 0x10, &amp;quot;struct LPC_WDT_Regs has incorrect size&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and in oder segment other error:&lt;/p&gt;
&lt;p&gt;#ifdef IEC_INPUTS_INVERTED&lt;br /&gt;static inline iec_bus_t iec_bus_read(void) {&lt;br /&gt; return (~IEC_INPUT) &amp;amp; (IEC_BIT_ATN | IEC_BIT_DATA | IEC_BIT_CLOCK | IEC_BIT_SRQ);&lt;br /&gt;}&lt;br /&gt;#else&lt;br /&gt;static inline iec_bus_t iec_bus_read(void) {&lt;br /&gt; return IEC_INPUT &amp;amp; (IEC_BIT_ATN | IEC_BIT_DATA | IEC_BIT_CLOCK | IEC_BIT_SRQ);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;IEC_CLOCK&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;lpc17xx/../iec-bus.h:45:68: error: &amp;#39;IEC_BIT_SRQ&amp;#39; undeclared (first use in this function); did you mean &amp;#39;IEC_BIT_ATN&amp;#39;?&lt;br /&gt; return IEC_INPUT &amp;amp; (IEC_BIT_ATN | IEC_BIT_DATA | IEC_BIT_CLOCK | IEC_BIT_SRQ);&lt;br /&gt; ^~~~~~~~~~~&lt;/p&gt;
&lt;p&gt;below link to 2 files:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://drive.google.com/file/d/1ISjmhER99hmYmDUjZKGDbAmklvLCtiOP/view?usp=sharing"&gt;https://drive.google.com/file/d/1ISjmhER99hmYmDUjZKGDbAmklvLCtiOP/view?usp=sharing&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://drive.google.com/file/d/1l5B-5R4kXiHXJX4gOlCXXSd28xxsqghL/view?usp=sharing"&gt;https://drive.google.com/file/d/1l5B-5R4kXiHXJX4gOlCXXSd28xxsqghL/view?usp=sharing&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;all project MPLAB-X-IDE 6.2:&lt;/p&gt;
&lt;p&gt;&lt;a title="All project" href="https://drive.google.com/file/d/14uKaJd1aC3qTCfq9pkvF3Kfn6K6FZW-0/view?usp=sharing"&gt;https://drive.google.com/file/d/14uKaJd1aC3qTCfq9pkvF3Kfn6K6FZW-0/view?usp=sharing&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STATIC_ASSERT and GCC (instead of Keil)</title><link>https://devzone.nordicsemi.com/thread/6157?ContentTypeID=1</link><pubDate>Wed, 09 Apr 2014 03:12:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d75c77ae-0625-4232-8cb2-3a6843110320</guid><dc:creator>Antonio</dc:creator><description>&lt;p&gt;Beautiful!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STATIC_ASSERT and GCC (instead of Keil)</title><link>https://devzone.nordicsemi.com/thread/6156?ContentTypeID=1</link><pubDate>Thu, 13 Feb 2014 19:05:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:373c2049-3e3c-4f5f-8de9-7e54c3f91d70</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;worked here as well&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STATIC_ASSERT and GCC (instead of Keil)</title><link>https://devzone.nordicsemi.com/thread/6155?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2014 17:03:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62d23471-4d5c-4bdc-94ad-8022147cecf9</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;Thanks!  That did the trick.  I&amp;#39;m now ale to build 5.1.0 with gcc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STATIC_ASSERT and GCC (instead of Keil)</title><link>https://devzone.nordicsemi.com/thread/6154?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2014 15:54:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dde6b64-36c5-47cb-b40f-86f75018bb3c</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;As far as I can see, this is a consequence of using GCC 4.8q4, in combination with -Werror, which turns all warnings into errors. Earlier versions of GCC have not given a warning on this construct, but it seems 4.8 does.&lt;/p&gt;
&lt;p&gt;The application note is written for a previous version of GCC, but there shouldn&amp;#39;t be any problems by using later versions if you just solve this one. That can either be done by removing the -Werror flag from line 60 of Makefile.common, or fix app_util.h as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
#define STATIC_ASSERT(EXPR) typedef char static_assert_failed[(EXPR) ? 1 : -1] __attribute__((unused))

&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>