[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fwd: RE: [avr-gcc-list] Address of code segment]
From: |
Robert von Knobloch |
Subject: |
[Fwd: RE: [avr-gcc-list] Address of code segment] |
Date: |
Fri, 29 Jan 2010 10:19:52 +0100 |
User-agent: |
Thunderbird 1.5.0.14 (X11/20060911) |
> org] On Behalf Of Robert von Knobloch
> Sent: Thursday, January 28, 2010 2:53 AM
> To: address@hidden
> Subject: [avr-gcc-list] Address of code segment
>
>
> CODESECTION uint16_t test7(void)
> {
> uint8_t size7prog;
>
> // Write assembler program to tester RAM. BEWARE of page size !!
> for (size7prog = 0; size7prog < (4 * 32); ++size7prog)
> parms.flashbuf[size7prog] =
> test_pgm_read_byte((PGM_VOID_P)(&test7prog + size7prog)); *****
> //.........
> // Having got the assembler in the ram buffer parms.flashbuf[
> ], I have
> existing routines to transfer the code to the target using ISP.
> //........
> }
>
> CODESECTION void test7prog(void)
> {
> asm ( "some assembler code \n\t"
> : : );
> }
>
> Although working, the starred line gives the warning "passing
> argument 1
> of 'test_pgm_read_byte' discards qualifiers from pointer target type"
> I had hoped the cast of (PGM_VOID_P) would help, but it doesn't.
> What is the 'right' way (from the compiler's view) to extract the
> address of the assembler code ?
> (I like a clean compile with no warnings).
You don't show us the prototype of test_pgm_read_byte. This is important
because this is the line that the warning is happening on. So we need all
information about this function.
Yes, I realised this later in the day (too late to post, I had gone home).
I found what I had misunderstood and have fixed it this morning.
Just to clarify 'test_pgm_read_byte()' is just a 'jmp pgm_read_byte' (The
avr-libc function).
I got the address of my assembler code with 'asmbase = 2 *
(uint16_t)&test7prog;' (x 2 to convert words to bytes)
and passed it with 'test_pgm_read_byte((pgm_uint8_t*)asmbase);'
Many thanks for your help anyway,
Robert
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fwd: RE: [avr-gcc-list] Address of code segment],
Robert von Knobloch <=