t-crest / patmos

Patmos is a time-predictable VLIW processor, and the processor for the T-CREST project
http://patmos.compute.dtu.dk
BSD 2-Clause "Simplified" License
135 stars 72 forks source link

Writing to UART using patmos emulator (patemu) does not seem to succeed correctly #82

Open andjo16 opened 3 years ago

andjo16 commented 3 years ago

The standard output does not seem to reflect the fact that the following program writes to the UART, when run through the Patmos emulator (patemu). It, however, does work fine with the simulator (pasim).

#include <machine/spm.h>

int main() {
    volatile _SPM int *uart_data = (volatile _SPM int *) 0xF0080004;    
    *uart_data = 'H';
    for(;;);
}

The loop is only there to make sure the program doesn't terminate the UART communication early.

The following two commands was used to run the program myhello.c as above in the emulator

$ make comp APP=myhello
$ patemu tmp/myhello.elf
schoeberl commented 3 years ago

The program should also print the character without the infinite loop. Furthermore, patemu does exit although there is an invite loop.

schoeberl commented 3 years ago

I tryied to reproduce the error (on the virtual machine that I provided for the course) and it works. My guess is that you built a version of the emulator before with some bootable that does ignore the .elf file. Can you please try again from a clean state:

make clean
make emulator
make comp APP=myhello
patemu tmp/myhello.elf

Thanks, Martin

andjo16 commented 3 years ago

It does not seem to make any difference to remake the emulator. Making the emulator does, however, induces a lot of warnings, which I don't know whether is expected.

I assume that it is correct to do all 4 commands you describe from /t-crest/patmos/.

I have found that removing the infinite loop from the code presented above the emulator does not only not print the character, it also still does not terminate. The simulator prints and terminates immediately, so even though the emulator may run slower, I would not expect the emulator to run for several minutes.

Andreas

schoeberl commented 3 years ago

We need to look further into this next lab time, as it worked on my VM.

Martin

On 9 Mar, 2021, at 18:01, andjo16 @.***> wrote:

It does not seem to make any difference to remake the emulator. Making the emulator does, however, induces a lot of warnings, which I don't know whether is expected.

I assume that it is correct to do all 4 commands you describe from /t-crest/patmos/.

I have found that removing the infinite loop from the code presented above the emulator does not only not print the character, it also still does not terminate. The simulator prints and terminates immediately, so even though the emulator may run slower, I would not expect the emulator to run for several minutes.

Andreas

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/t-crest/patmos/issues/82#issuecomment-794165712, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE63GBR6JUA7GYEDOGE4RLTCZH7BANCNFSM4YPILXOA.