Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix I_DELAY macro #1310

Closed
wants to merge 1 commit into from
Closed

Bugfix I_DELAY macro #1310

wants to merge 1 commit into from

Conversation

mwyborski
Copy link
Contributor

When compiling

const ulp_insn_t program[] = {
I_DELAY(1)
};

with the xtensa-esp32-elf-g++ compiler i always got the error:

sorry, unimplemented: non-trivial designated initializers not supported

   };

This was due to the different order in the macro and the struct. The struct has another order of the fields (opcode, unused, cycles) vs (cycles, unused, opcode):

struct {
uint32_t cycles : 16; /*!< Number of cycles to sleep /
uint32_t unused : 12; /
!< Unused /
uint32_t opcode : 4; /
!< Opcode (OPCODE_DELAY) /
} delay; /
!< Format of DELAY instruction */

After updating the order in the macro it is possible to compile with the g++ compiler.

When compiling 

> const ulp_insn_t program[] = {
> I_DELAY(1)
> };

with the xtensa-esp32-elf-g++ compiler i always got the error:

> sorry, unimplemented: non-trivial designated initializers not supported
> 
>        };

This was due to the different order in the macro and the struct. The struct has another order of the fields (opcode, unused, cycles) vs (cycles, unused, opcode):
>    struct {
>        uint32_t cycles : 16;       /*!< Number of cycles to sleep */
>        uint32_t unused : 12;       /*!< Unused */
>        uint32_t opcode : 4;        /*!< Opcode (OPCODE_DELAY) */
>    } delay;                        /*!< Format of DELAY instruction */

After updating the order in the macro it is possible to compile with the g++ compiler.
@CLAassistant
Copy link

CLAassistant commented Nov 23, 2017

CLA assistant check
All committers have signed the CLA.

@projectgus projectgus added the Status: Pending blocked by some other factor label Dec 6, 2017
@projectgus
Copy link
Contributor

Thanks @robotrovsky . I've cherry-picked this into our review & merge queue.

@mwyborski
Copy link
Contributor Author

Thanks to you @projectgus and the ESP32 team, you made an incredible platform!! Anyways i think this is more a compiler issue than a IDF issue.

@projectgus
Copy link
Contributor

Yes, C++ is backwards-compatible with C except for a few additional rules like this one for PODs.

We try to catch these at time of writing, but because most of our code is in C some can slip through.

igrr pushed a commit that referenced this pull request Dec 11, 2017
When compiling

> const ulp_insn_t program[] = {
> I_DELAY(1)
> };

with the xtensa-esp32-elf-g++ compiler i always got the error:

> sorry, unimplemented: non-trivial designated initializers not supported
>
>        };

This was due to the different order in the macro and the struct. The struct has another order of the fields (opcode, unused, cycles) vs (cycles, unused, opcode):
>    struct {
>        uint32_t cycles : 16;       /*!< Number of cycles to sleep */
>        uint32_t unused : 12;       /*!< Unused */
>        uint32_t opcode : 4;        /*!< Opcode (OPCODE_DELAY) */
>    } delay;                        /*!< Format of DELAY instruction */

After updating the order in the macro it is possible to compile with the g++ compiler.

Merges #1310
@projectgus
Copy link
Contributor

Cherry-picked as 6a51a13. Thanks!

@projectgus projectgus closed this Dec 12, 2017
igrr pushed a commit that referenced this pull request Dec 29, 2017
When compiling

> const ulp_insn_t program[] = {
> I_DELAY(1)
> };

with the xtensa-esp32-elf-g++ compiler i always got the error:

> sorry, unimplemented: non-trivial designated initializers not supported
>
>        };

This was due to the different order in the macro and the struct. The struct has another order of the fields (opcode, unused, cycles) vs (cycles, unused, opcode):
>    struct {
>        uint32_t cycles : 16;       /*!< Number of cycles to sleep */
>        uint32_t unused : 12;       /*!< Unused */
>        uint32_t opcode : 4;        /*!< Opcode (OPCODE_DELAY) */
>    } delay;                        /*!< Format of DELAY instruction */

After updating the order in the macro it is possible to compile with the g++ compiler.

Merges #1310
@igrr igrr removed the Status: Pending blocked by some other factor label Aug 9, 2018
0xFEEDC0DE64 pushed a commit to 0xFEEDC0DE64/esp-idf that referenced this pull request May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants