Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
andjo16 opened this issue Mar 2, 2021 · 4 comments

Comments

@andjo16
Copy link

andjo16 commented Mar 2, 2021

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
Copy link
Member

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

@schoeberl
Copy link
Member

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
Copy link
Author

andjo16 commented Mar 9, 2021

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
Copy link
Member

schoeberl commented Mar 10, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants