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

Megaflash CRC check fix for attic-less boards; a minor fix and an addition for the Wukong board #839

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 14 additions & 23 deletions src/utilities/megaflash/mf_hlflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,31 +408,22 @@ int8_t mfhf_load_core() {
}
nhsd_close();

#if defined(NO_ATTIC) || defined(STANDALONE)
#ifdef STANDALONE
if (mfhf_attic_disabled) {
#endif/* STANDALONE */
mfhf_core_file_state = (core_crc != get_crc32() || first) ? MFHF_LC_NOTLOADED : MFHF_LC_FROMDISK;
mfp_set_area(0, length, mfhf_core_file_state != MFHF_LC_ATTICOK ? 'E' : ' ', MHX_A_INVERT|(mfhf_core_file_state != MFHF_LC_ATTICOK ? MHX_A_RED : MHX_A_GREEN));
if (mfhf_core_file_state != MFHF_LC_ATTICOK) {
mfhf_display_sderror("CRC32 Checksum Error!", NHSD_ERR_NOERROR);
return mfhf_core_file_state;
}
return mfhf_core_file_state;
#ifdef STANDALONE
}
#endif/* STANDALONE */
#if defined(NO_ATTIC) || defined(STANDALONE)
if (core_crc == get_crc32() && !first)
mfhf_core_file_state = MFHF_LC_FROMDISK;
#endif /* NO_ATTIC || STANDALONE */

if (addr & 0xffff)
mfp_set_area(addr >> 16, 1, 0x5f, MHX_A_WHITE);

// mhx_press_any_key(MHX_AK_NOMESSAGE, MHX_A_NOCOLOR);

#ifdef STANDALONE
if (!mfhf_attic_disabled) {
} else {
#endif/* STANDALONE */
#if !defined(NO_ATTIC) || defined(STANDALONE)
if (addr & 0xffff)
mfp_set_area(addr >> 16, 1, 0x5f, MHX_A_WHITE);

// mhx_press_any_key(MHX_AK_NOMESSAGE, MHX_A_NOCOLOR);

// check crc32 of file as a check for ATTIC RAM, too
mfp_start(0, MFP_DIR_UP, 0xa0, MHX_A_WHITE, " Checking CRC32 ", MHX_A_WHITE);
make_crc32_tables(data_buffer, cfi_data);
Expand All @@ -458,21 +449,21 @@ int8_t mfhf_load_core() {
if (mhx_lastkey.code.key == 0x03 || mhx_lastkey.code.key == 0x1b)
return MFHF_LC_NOTLOADED;
}

if (core_crc == get_crc32() && !first)
mfhf_core_file_state = MFHF_LC_ATTICOK;
mfp_set_area(0, length, mfhf_core_file_state != MFHF_LC_ATTICOK ? 'E' : ' ', MHX_A_INVERT|(mfhf_core_file_state != MFHF_LC_ATTICOK ? MHX_A_RED : MHX_A_GREEN));

if (mfhf_core_file_state != MFHF_LC_ATTICOK) {
mfhf_display_sderror("CRC32 Checksum Error!", NHSD_ERR_NOERROR);
return MFHF_LC_NOTLOADED;
}
// set potentially changed flags after load & crc check
lpoke(0x8000000L + MFSC_COREHDR_BOOTFLAGS, mfsc_corehdr_bootflags);
#endif /* !NO_ATTIC || STANDALONE */
#ifdef STANDALONE
}
#endif/* STANDALONE */

mfp_set_area(0, length, mfhf_core_file_state == MFHF_LC_NOTLOADED ? 'E' : ' ', MHX_A_INVERT|(mfhf_core_file_state == MFHF_LC_NOTLOADED ? MHX_A_RED : MHX_A_GREEN));
if (mfhf_core_file_state == MFHF_LC_NOTLOADED)
mfhf_display_sderror("CRC32 Checksum Error!", NHSD_ERR_NOERROR);

// mhx_press_any_key(MHX_AK_NOMESSAGE, MHX_A_NOCOLOR);

return mfhf_core_file_state;
Expand Down
3 changes: 0 additions & 3 deletions src/utilities/megaflash/s25flxxxs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@

extern void * const s25flxxxs;

// char write_dynamic_protection_bits(unsigned int sector_number, BOOL protect);
char write_dynamic_protection_bits(unsigned long address, BOOL protect);

#endif
6 changes: 3 additions & 3 deletions src/vhdl/wukong.vhdl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ entity container is
reset_button : in std_logic;

-- Keyboard.
porta_pins : inout std_logic_vector(7 downto 0);
portb_pins : inout std_logic_vector(7 downto 0);
restore_key : in std_logic;
porta_pins : inout std_logic_vector(7 downto 0);
portb_pins : inout std_logic_vector(7 downto 0);

-- Joysticks.
fa_left : in std_logic;
Expand Down Expand Up @@ -86,7 +87,6 @@ architecture Behavioral of container is
signal pixelclock : std_logic;
signal clock27 : std_logic;
signal clock270 : std_logic;
signal restore_key : std_logic := '1';
signal sector_buffer_mapped : std_logic;
signal fpga_temperature : std_logic_vector(11 downto 0) := (others => '0');

Expand Down
2 changes: 1 addition & 1 deletion src/vhdl/wukong.xdc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set_property -dict {PACKAGE_PIN P18 IOSTANDARD LVCMOS33 } [get_po
# Buttons.
################################################################################
set_property -dict {PACKAGE_PIN H7 IOSTANDARD LVCMOS33} [get_ports reset_button];
#set_property -dict {PACKAGE_PIN M6 IOSTANDARD LVCMOS33} [get_ports button2 ];
set_property -dict {PACKAGE_PIN M6 IOSTANDARD LVCMOS33} [get_ports restore_key ];

################################################################################
# LEDs.
Expand Down
4 changes: 2 additions & 2 deletions vivado/wukong_gen.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ set files [list \
"[file normalize "$origin_dir/src/vhdl/uart_rx_buffered.vhdl"]"\
"[file normalize "$origin_dir/src/vhdl/buffereduart.vhdl"]"\
"[file normalize "$origin_dir/src/vhdl/sid_6581.vhdl"]"\
"[file normalize "$origin_dir/src/vhdl/shadowram-a100t.vhdl"]"\
"[file normalize "$origin_dir/src/vhdl/shadowram-s25flxlno.vhdl"]"\
"[file normalize "$origin_dir/src/vhdl/sdcardio.vhdl"]"\
"[file normalize "$origin_dir/src/vhdl/audio_mixer.vhdl"]"\
"[file normalize "$origin_dir/src/vhdl/audio_complex.vhdl"]"\
Expand Down Expand Up @@ -528,7 +528,7 @@ set file "vhdl/sid_6581.vhdl"
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL" -objects $file_obj

set file "vhdl/shadowram-a100t.vhdl"
set file "vhdl/shadowram-s25flxlno.vhdl"
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL" -objects $file_obj

Expand Down