On Mon, Feb 22, 2016 at 02:57:43PM +0530, Hari Narasimhan H.N wrote: > Dear Sir, > > We are getting the following error "section type conflict" with xtensa > gcc when a const and non const global variable is placed in the same > section? > > I am using a bare metal cross gcc toolchain for Xtensa architecture > built as per instructions in > http://wiki.linux-xtensa.org/index.php/Crosstool-NG. We are using a > custom Xtensa processor in our firmware. > > For example consider the code below > > __attribute__((section(".dram0.data"))) int x; > __attribute__((section(".dram0.data"))) const int y = 10;
This is user error. You really shouldn't mix const and non-const variables in the same section, the non-const vars want a writable section, while the const ones (unless they need dynamic relocations) want read-only section. Put them into separate sections, and perhaps through a linker script combine them together if you for whatever strange reason need that. Jakub