Hello,
I have a doubt about pre-compiler.
I have defined to attributes for my variables, one for global, and one for local vars.
Quote:
#define _GLOBAL __attribute__((__weak__,__section__(".global_var")))
#define _LOCAL __attribute__((__weak__,__section__(".local_var")))
|
Now in my programm I can declarate my new vars:
Quote:
#include <stdio.h>
#include <stdlib.h>
#include "types_plc.h"
_GLOBAL UINT value;
_GLOBAL UINT value_2;
_LOCAL UINT value_3;
_LOCAL UINT value_4;
....
....
|
Now I have two new section, .global_var and .local_var.
Quote:
[24] .data PROGBITS 0804a008 001008 000008 00 WA 0 0 4
[25] .global_var PROGBITS 0804a010 001010 000004 00 WA 0 0 2
[26] .local_var PROGBITS 0804a014 001014 000004 00 WA 0 0 2
[27] .bss NOBITS 0804a018 001018 00000c 00 WA 0 0 4
|
But now, I would like to asign the same atributes to other vars in my project, for example:
Quote:
#include <stdio.h>
#include <stdlib.h>
#include "types_plc.h"
_GLOBAL UINT value;
_GLOBAL UINT value_2;
_LOCAL UINT value_3;
_LOCAL UINT value_4;
void prueba (void)
{
_LOCAL UINT value_1; <----- HERE IS MY PROBLEM
_LOCAL UDINT dir_1;
value_1 = 2;
dir_1 = 0;
//printf("Prueba, dir = %p.\n", dir_1);
//printf("Prueba, value_1 = %p.\n", &value_1);
}
int main(void)
{
static UDINT direccion;
value = 0;
.................
|
Is it possible to change attributes of this variables to allocate in other section???
best regards