VexRiscv icon indicating copy to clipboard operation
VexRiscv copied to clipboard

println function not working

Open nikita890-art opened this issue 2 years ago • 4 comments

Hi... I am trying to execute this code, . . . void print(const char*str){ while(*str){ uart_write(UART,str); str++; } } void println(const charstr){ print(str); uart_write(UART,'\n'); } void delay(uint32_t loops){ for(int i=0;i<loops;i++){ int tmp = GPIO_A->OUTPUT; } } int main() { char message[1024]="what's your name\n"; GPIO_A->OUTPUT_ENABLE = 0x0000000F; GPIO_A->OUTPUT = 0x00000001; println("what's your name"); . . . When I dump this code in the arty board, it gives some random output like a special character. So, I try to run it on spike and I get a segmentation fault.

What can I do?

Note: This is just the snippet of the code. The actual code is kinda big. I dont think the entire code matters as I dont really use any println statement other than this one in my code but just in case if needed, I can upload it in the drive.

nikita890-art avatar Nov 08 '21 13:11 nikita890-art

Hi,

A few question :

  • Which soc are you using ?
  • Which toplevel synthesis scripts are you using ?
  • Did you checked the uart output on a scope or a simulation ?

This won't work on spike i guess, as it does not implement the same peripherals.

Dolu1990 avatar Nov 08 '21 13:11 Dolu1990

  1. the board I am using is arty a7 35T
  2. I am not sure about the synthesis scripts but we are performing synthesis on vivado
  3. no @Dolu1990

nikita890-art avatar Nov 09 '21 04:11 nikita890-art

Is there any way I can get the message printed? @Dolu1990

nikita890-art avatar Nov 09 '21 13:11 nikita890-art

I would say, the best is to scope the uart to understand the symptoms better.

Are you sure the frequency of the clock match the one specified at the SpinalHDL generation ? The uart divider get a value depending on it.

Dolu1990 avatar Nov 09 '21 13:11 Dolu1990