Skip to content

Commit

Permalink
[sw/lib] pass impid to print_hw_version as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
stnolting committed Jan 11, 2025
1 parent eac657f commit 69bc5bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sw/bootloader/bootloader.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ================================================================================ //
// The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 //
// Copyright (c) NEORV32 contributors. //
// Copyright (c) 2020 - 2024 Stephan Nolting. All rights reserved. //
// Copyright (c) 2020 - 2025 Stephan Nolting. All rights reserved. //
// Licensed under the BSD-3-Clause license, see LICENSE for details. //
// SPDX-License-Identifier: BSD-3-Clause //
// ================================================================================ //
Expand Down
3 changes: 1 addition & 2 deletions sw/lib/include/neorv32_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/**
* @file neorv32_aux.h
* @brief General auxiliary functions header file.
* @see https://stnolting.github.io/neorv32/sw/files.html
*/

#ifndef neorv32_aux_h
Expand Down Expand Up @@ -51,7 +50,7 @@ uint64_t neorv32_aux_hexstr2uint64(char *buffer, unsigned int length);
uint32_t neorv32_aux_xorshift32(void);
void neorv32_aux_itoa(char *buffer, uint32_t num, uint32_t base);
void neorv32_aux_print_hw_config(void);
void neorv32_aux_print_hw_version(void);
void neorv32_aux_print_hw_version(uint32_t impid);
void neorv32_aux_print_about(void);
void neorv32_aux_print_logo(void);
void neorv32_aux_print_license(void);
Expand Down
12 changes: 7 additions & 5 deletions sw/lib/source/neorv32_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/**
* @file neorv32_aux.c
* @brief General auxiliary functions source file.
* @see https://stnolting.github.io/neorv32/sw/files.html
*/

#include <neorv32.h>
Expand Down Expand Up @@ -302,7 +301,7 @@ void neorv32_aux_print_hw_config(void) {
neorv32_cpu_csr_read(CSR_MIMPID));
// hardware version
neorv32_uart0_printf(" (v");
neorv32_aux_print_hw_version();
neorv32_aux_print_hw_version(neorv32_cpu_csr_read(CSR_MIMPID));
neorv32_uart0_printf(")\n");

// CPU architecture and endianness
Expand Down Expand Up @@ -535,17 +534,20 @@ void neorv32_aux_print_hw_config(void) {


/**********************************************************************//**
* Print the processor version in human-readable format via UART0.
* Print processor version in human-readable format via UART0.
*
* @param[in] impid BCD-coded implementation ID (aka the version),
* typically from the mimpid CSR.
**************************************************************************/
void neorv32_aux_print_hw_version(void) {
void neorv32_aux_print_hw_version(uint32_t impid) {

uint32_t i;
char tmp, cnt;

if (neorv32_uart0_available() != 0) { // cannot output anything if UART0 is not implemented
for (i=0; i<4; i++) {

tmp = (char)(neorv32_cpu_csr_read(CSR_MIMPID) >> (24 - 8*i));
tmp = (char)(impid >> (24 - 8*i));

// serial division
cnt = 0;
Expand Down

0 comments on commit 69bc5bf

Please sign in to comment.