This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem: Table of constants in an ASMed C file

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 the .src file:
?CO?ASMSUBS          SEGMENT CONST
What am I doing wrong?

Parents Reply Children

  • Ah. I'm afraid you might have to make a choice, then.

    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.

    A51 apparently supports BIT, CODE, DATA, IDATA, and XDATA. You need AX51 for CONST, EBIT, EDATA, ECONST, ECODE, HCONST, and HDATA.

    If you don't want to use AX51, I'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.

  • I tried various combinations of 'code' and 'const' to no avail. In the end I rewrote the function with the table in assembler defined using 'DB' values and that solved my immediate problem. Thanks to all.