Re: **** BINDER ERROR 19 **** Data block cannot be allocated in TAL

On Apr 1, 11:29 am, Keith Dick <kd...@xxxxxxx> wrote:
vimal wrote:
I am getting Binder error 19 when trying to bind two source files in
TAL. Is there a way to reorganize the data space or increase the space
location. Currently, the error says "Data block trying to fit below
256". Please help.

Of course you mean when trying to bind two TAL object files together, right?

The short answer is that no, there probably is no easy way to solve that problem, unless you have not been careful with your global variables up to this point.  This is a fairly common problem in large TAL programs.  If you can switch your program to pTAL, you do not have this limit on the number of globals, but switching to pTAL sometimes is not easy.

When in TAL you declare an indirect variable that is global or in a named block, the word that contains the pointer to the actual data must be placed in the first 256 words of the address space, since the T/16 instructions normally used to do an indirect access to a global can only use pointers in those first 256 words.  This means you are limited to a total of 256 global indirect variables or pointers in all of the object files you bind together.  If any of those are extended indirect variables or extended pointers, those take two words each, reducing the total to less than 256.

If your program contains some global direct variables that are larger than one word (a lot of INT(32) or FIXED variables, or a lot of arrays or structs that are not declared indirect), then changing the program might not be very difficult.  Changing such declarations from direct to indirect will reduce the under 256 requirement.  For simple variables, you need to change the declaration from a simple variable to a one-element array (otherwise, that would be declaring a pointer, which does not allaocate space for the data).  For example:

    FIXED A;

should become:

    FIXED .A[0:0];

The references to A would not have to be changed, since a reference to an array name without a subscript is taken to be a reference to position 0 of the array.

If you have global direct arrays or STRUCTs, just add the "." to the declaration.  For example:

    INT B[0:20];
      INT X;
      INT Y;
      INT Z;

should become:

    INT .B[0:20];
    STRUCT .C;
      INT X;
      INT Y;
      INT Z;

To change the STRUCT, you add the "." before only the STRUCT name, not before the field names.

Assuming the program does not waste under 256 space in any of the above ways, you have to make more difficult changes.

One thing that you might be able to do is move some globals to the local variables of some procedure in the program, usually the main procedure.  This isn't possible if those variable names actually are being accessed by the global names from several procedures, but sometimes the global name is only referenced from the main procedure and passed as a parameter to other procedures.

Another thing that you can do is gather a number of the global variables into a single STRUCT.  That reduces the number of under 256 words needed to reference those variables from one per variable to just one (for the STRUCT).  This does require changes to all the references to those variable, which could be a lot of work.  Usually it is possible to make the names of the fields in the STRUCT be slightly different than the original global variable names (add a prefix, for example), then you can declare a DEFINE with the original global variable's name to be the <structure name>.<field name>.  If you do that, you do not have to find and change all the references to the global variables.  I have a feeling that there is at least one way such variables could be used that will not tolerate substitution of a DEFINE name, but I cannot remember what that way is.  Perhaps I have that mixed up with something else.  In any event, most simple references will work, so only a few would hav
e to be changed if my feeling is correct.  Some people dislike the DEFINE trick, because when reading the code where a reference to the global is made, there is no hint that it is now a global structure reference, so symbolic debugging can be frustrating, since you have to recognize that the variable is one that was moved into a structure and reference the structure and field in your debugger commands.

I think those are your only options, assuming you cannot simply switch to pTAL, which does not have the under 256 limit.

If I did not explain some of that well enough, ask for clarification.

Thanks Keith Dick. I had used some global direct arrays and structs,
after changing them to indirect, the issue got resolved. Thanks a
lot :)

Relevant Pages

  • Re: Am I being too C++ like?
    ... typedef struct stack Stack; ...    typedef struct stack stack; ... I have seen this when the interface is designed before the language is ...
  • Re: #defining an array within another in C language
    ... you do not know the number of elements of the array. ...     int var; ... C99 flexible array members or the plain old "struct hack". ...
  • Re: Hidden One Instance
    ... are located in the file scope, but they are acting to be old-fashioned ... The wrapper means to group member variables and member functions ... struct CPU CPU_Object is only ...
  • Re: [PATCH 2/5] ftrace: infrastructure for supporting binary record
    ... save on memory for tracing ... Current tracers are typically using a struct(like struct ftrace_entry, ...     default y ... +static inline void unlock_btrace ...
  • Re: prototypes and struct quest.
    ... just 3-8 short ints to make a date down to microseconds. ...     I have changed that in my source a drew up roughly in a .c file to int ... struct stk * { ...