<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/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/"><channel><title>Problem: Table of constants in an ASMed C file</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/15413/problem-table-of-constants-in-an-asmed-c-file</link><description> I want to define a table of constants like this: 
 
code const unsigned char bit_count_table[16] = {	0, 1, .... 4 };
 
in a C source file built with the ASM option. 
 
I get error A24: SEGMENT TYPE EXPECTED 
 
with a reference to this line of code in</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Problem: Table of constants in an ASMed C file</title><link>https://community.arm.com/thread/110233?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2003 10:58:13 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d13e7130-038e-4f52-9792-22d52d7c1577</guid><dc:creator>Graham Cole</dc:creator><description>&lt;p&gt;I tried various combinations of &amp;#39;code&amp;#39; and &amp;#39;const&amp;#39; to no avail. In the end I rewrote the function with the table in assembler defined using &amp;#39;DB&amp;#39; values and that solved my immediate problem. Thanks to all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Table of constants in an ASMed C file</title><link>https://community.arm.com/thread/95352?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2003 10:46:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:87ae14b2-dc07-4c40-a7ea-64ad81862ebf</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;&lt;br /&gt;
Ah.  I&amp;#39;m afraid you might have to make a choice, then.&lt;br /&gt;
&lt;br /&gt;
In my manual where it talks about classes for segments (page 107 of the assembler manual) the chart shows the CONST class highlighted in green, which the footnote says means a feature only available in AX51 / A251.&lt;br /&gt;
&lt;br /&gt;
A51 apparently supports BIT, CODE, DATA, IDATA, and XDATA.  You need AX51 for CONST, EBIT, EDATA, ECONST, ECODE, HCONST, and HDATA.&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#39;t want to use AX51, I&amp;#39;d think you would be able to declare your segment as CODE in A51.  It seems the only thing CONST really buys you is semantics: letting the assembler know to reject any instructions that might appear in the segment, hopefully not to jump to labels in that segment, and so on.&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Table of constants in an ASMed C file</title><link>https://community.arm.com/thread/55015?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2003 07:34:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:77e689a0-6b06-43e0-8eef-e3e51cad1a66</guid><dc:creator>Graham Cole</dc:creator><description>&lt;p&gt;Yes I am using A51 and I would like to keep it that way if at all possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Table of constants in an ASMed C file</title><link>https://community.arm.com/thread/39757?ContentTypeID=1</link><pubDate>Mon, 10 Feb 2003 13:33:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ba67b8f1-fbc0-4ca9-84d4-1df88018c52c</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;&lt;br /&gt;
Using A51 instead of AX51?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>