I used to do WEB-related programs in the past,
I recently got a job using C language and a microcomputer.
I usually use GHS Green hills at work for my compiler.
I've never used anything other than Green Hills,
Make extensive use of C volatile and structure casting
Data in memory is accessed from the address value.
(* ((volatile My_structure *) (0x40520000))). child.register = 0I want to cast from the address value and input the value like
Honestly for personal reasons, I don't think the above code is correct from experienced people,
Is it possible to access the above structure from the header file or the address value defined in define?
Once you have a model and simple declaration and access,
I would like to know the compilers that I confirmed for the exercise.
Thanks for your professor.
Please reply because anything is fine.
Answer # 1
That is normal, there is no mistake or anything.
For example, the peripheral device address definition file provided by the manufacturer of Renesas RX microcontrollers is as follows:
iodefine.h #define AD (* (volatile struct st_ad __evenaccess *) 0x89800) #define BSC (* (volatile struct st_bsc __evenaccess *) 0x81300) #define CAN0 (* (volatile struct st_can __evenaccess *) 0x90200) #define CAN1 (* (volatile struct st_can __evenaccess *) 0x91200) #define CAN2 (* (volatile struct st_can __evenaccess *) 0x92200) #define CMT (* (volatile struct st_cmt __evenaccess *) 0x88000) #define CMT0 (* (volatile struct st_cmt0 __evenaccess *) 0x88002) #define CMT1 (* (volatile struct st_cmt0 __evenaccess *) 0x88008) #define CMT2 (* (volatile struct st_cmt0 __evenaccess *) 0x88012) #define CMT3 (* (volatile struct st_cmt0 __evenaccess *) 0x88018) #define CRC (* (volatile struct st_crc __evenaccess *) 0x88280)
Now, for example
CAN0.CTLR.BIT.CANM = 0;
and you can access the register
The keyword __evenaccess is a keyword specific to the Renesas compiler,
If the __evenaccess qualifier of the extended function is added when declaring a variable, an instruction to access with the declared type size is output.
Answer # 2
Use the arrow operator.
- c - i want to find the sum of odd and odd numbers from the array elements
- i want to display array elements with a triple pointer (c)
- A solution to the error of accessing array elements based on PHP double quotes
- DWR3 two methods of accessing web elements
- c - a program that inputs the number of elements in an array with the keyboard, and wants to support any positive integer
- c - find the number of elements in an array
- c - valid range of pointer to n elements
- i would like to know the cause of the difference in results due to optimization
- i can't compile c
- about c language compiler error
- "aexe has stopped working" occurs at "c = r% scl;"
- i get an segmentation fault (core dumped) error
- c - what is inline assembly "\ n->" #sym "% 0" #val?
- it should be compared with 4 bytes, but it is compared with 5 bytes
- gcc does not pass through vscode power shell
- c# - question on creating animation with opengl
- c++ - questions about the opengl perspective