We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I would appreciate your help to fix this problem: -------------------------------------------------- <main.c>
// include files #include "main.h"
// main int main(void) { //test code for problem in h file
while (reg1) { // wait } }
// end
<main.h>
volatile unsigned char reg1 __at 0x40004000; //see the semicolon?
<build>
Build target 'Target 1'
compiling main.c...
main.h(1): error: #65: expected a ";"
Target not created
----------------------------------- Eric
I copied the absacc.h file from ARM/RV30/INC into my project folder and tried this:
Realview Compiler ------------------- main.c ------------------- #include "absacc.h" #include "main.h"
int main(void) { int portA; //test code for problem in h file portA = gpio_pins; } -------------------- absacc.h -------------------- /* absacc.h: header file that allows absolute variable location at C level */ /* Copyright 2006 ARM Limited. All rights reserved. */ /* version 0.01 */
#ifndef __at #define __at(_addr) __attribute__ \ ((section (".ARM.__AT_" #_addr)))
#endif --------------------- main.h --------------------- volatile unsigned long gpio_pins __at(0x40004000); --------------------- Build target 'Target 1'
main.c(7): warning: #550-D: variable "portA" was set but never used
linking...
debug.axf: error: L6938E: Invalid value for --ro-base.
After looking over many posts on this subject, (most of which did not work or were way too messy), this finally took care of the problem:
#include <absacc.h> or copy it from ARM/RV30/INC or from here into your project folder and use #include "absacc.h"
Realview Compiler
Project Options for target (target) Linker folder tab upper right hand corner R/O Base: 0x40000000 (lowest read-only addr) R/W Base: 0x40004000 (lowest R/W addr)
------------------- main.c ------------------- #include "absacc.h" #include "main.h"
int main(void) {
int test;
/* test code */
test = gpio_pins;
gpio_pins = test;
}
-------------------- absacc.h -------------------- /* absacc.h: header file that allows absolute variable location at C level */ /* Copyright 2006 ARM Limited. All rights reserved. */ /* version 0.01 */
#endif --------------------- main.h --------------------- /* assign variable to absolute location */ /* use __at with 2 underscores in front and left paren in back */
volatile unsigned long gpio_pins __at(0x40004000); --------------------- Build! --------------------- Build target 'Target 1' compiling main.c... linking... "debug.axf" - 0 Error(s), 0 Warning(s).