Thanks Clifford for your inputs,
For the time being I am approaching ARM by programming, latern I will
get the development board to doing some tests (or a real application).
As example I have utilized the "at91sam7s64_uart_simple" base code
adjusted to the below code (updated based on your input).
I have considered to pass the address of the USART and status register
directly without the structure (easy to read in one page, just for the
example).
Regarding the warning, I saw that the first compiling is generating
warnings, but recompiling without changing anything, the warnings
disappear (I am using the programmer notepad of winarm, I really like
the way is organized: easy and quick to go).
Anyway, the warning I had were the following:
main.c:28: warning: assignment makes pointer from integer without a cast
main.c:29: warning: assignment makes pointer from integer without a cast
linked with the code:
pCSR=CSR;
pTHR=THR;
This is the code with your input:
1 | #define TXRDY ((unsigned int) 0x1 << 1) // TXRDY Interrupt
|
2 | #define CSR ((unsigned int) 0xFFF70000) // Status register
|
3 | #define THR ((unsigned int) 0xFFF50000) // Transmitter Holding Register
|
4 |
|
5 | int main(void)
|
6 | {//* Begin
|
7 | unsigned int *mem; // Pointer to memory address
|
8 | unsigned int *pCSR; // Pointer to USART0 Status Register
|
9 | unsigned int *pTHR; // Pointer to USART0 TX Buffer
|
10 |
|
11 | pCSR=CSR; // set pointer to USART status register
|
12 | pTHR=THR; // set pointer to TX buffer address
|
13 | mem=0x100; // Start pointer with an offset
|
14 | // Loop forever
|
15 | for (;;)
|
16 | {
|
17 | while (!(*pCSR & TXRDY)); // Wait for Empty Tx Buffer
|
18 | *pTHR = *mem; // Transmit Character
|
19 | mem++; // increase mem pointer
|
20 |
|
21 | if(mem>0xFFFF) mem=0x100; // check top memory reached -> restart
|
22 |
|
23 | } // End for
|
24 |
|
25 | } //* End
|
I saw the .hex file generated and it is really big compared with the few
above code lines, do you know why?
What is the way to obtain an asm file to see what the compiler is doing?
Thanks for your help.