2012-07-02 11:32 PM
hi i want to place value - ''address of station'' at fixed memory address
without specifed address its look like &sharpdefine mcu_address 0x03 i found - it may looks like &sharpdefine mcu_address (*((volatile unsigned long *) 0x20000000)) mcu_address = 0x03; //here i have syntax error i am using coocox ide... thanks for all ideas ... #value-address2012-07-03 03:39 AM
Both Keil 4.53 and GCC 4.7.1 are tolerant of that, perhaps a more complete exemplar that demonstrates the issue would help. Is it the compiler or the IDE reporting this error, which version of GCC?
The typical method is unsigned long *foo = (unsigned long *)0x20000000; *foo = 12345; foo[1] = 67890;2012-07-03 02:47 PM
''here i have syntax error''
You need to show the full text of the error. And, as clive1 says, you also need to show a complete example.
2012-07-03 10:38 PM
ok -
so i used this in my code and it works great : #define rts_1 GPIOA->ODR |= (1 << 12); //rs485 #define rts_0 GPIOA->ODR &= ~(1 << 12); //rs485 #define adresa 0x03 then i have something like rx_packet 24byte - adress of mcu is on rx_packet[2] in code i check if address is valid if (adresa ==rx_packet[2] ){Decode_Packet(p);} /***************************************/ when i used this definition #define mcu_address (*((volatile unsigned long *) 0x20000000)) mcu_address = 0x03; //here i have syntax error -it show ''?'' in coocox and in compile log i have [cc] C:\CooCox\CoIDE\workspace\DMA\main.c:93: error: expected identifier or '(' before 'volatile' [cc] C:\CooCox\CoIDE\workspace\DMA\main.c:93: error: expected ')' before numeric constant so i tried used clive's example unsigned long *foo = (unsigned long *)0x20000000; *foo = 12345; // error: conflicting types for 'foo' foo[1] = 67890; // error: conflicting types for 'foo' and error: invalid initializer i use gcc arm-none-eabi-gcc-4.4.1 all in all i only want to have const or variable of device address on my memory adress where i want .... thanks for yours posts guys ...