fixes for compiling with gcc 10

gcc 10 no longer lets you get away with not externing global variables in header files. This adds the necessary extern and adds defines in appropriate c files
This commit is contained in:
Dave Murphy 2020-05-08 23:32:44 +01:00
parent 9698cbc9d7
commit cc54df87d7
28 changed files with 102 additions and 40 deletions

View file

@ -19,6 +19,10 @@
#include <string.h> #include <string.h>
#include "gfx.h" #include "gfx.h"
// Global gfx console and context.
gfx_ctxt_t gfx_ctxt;
gfx_con_t gfx_con;
static const u8 _gfx_font[] = { static const u8 _gfx_font[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 032 ( ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 032 ( )
0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x0C, 0x00, // Char 033 (!) 0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x0C, 0x00, // Char 033 (!)

View file

@ -49,7 +49,7 @@ void gfx_set_rect_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 po
void gfx_render_bmp_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos_y); void gfx_render_bmp_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos_y);
// Global gfx console and context. // Global gfx console and context.
gfx_ctxt_t gfx_ctxt; extern gfx_ctxt_t gfx_ctxt;
gfx_con_t gfx_con; extern gfx_con_t gfx_con;
#endif #endif

View file

@ -36,6 +36,10 @@
extern hekate_config h_cfg; extern hekate_config h_cfg;
extern const u8 package2_keyseed[]; extern const u8 package2_keyseed[];
u32 pkg2_newkern_ini1_val;
u32 pkg2_newkern_ini1_start;
u32 pkg2_newkern_ini1_end;
#ifdef KIP1_PATCH_DEBUG #ifdef KIP1_PATCH_DEBUG
#include "../utils/util.h" #include "../utils/util.h"
#define DPRINTF(...) gfx_printf(__VA_ARGS__) #define DPRINTF(...) gfx_printf(__VA_ARGS__)

View file

@ -30,9 +30,9 @@
#define PKG2_NEWKERN_GET_INI1_HEURISTIC 0xD2800015 // Offset of OP + 12 is the INI1 offset. #define PKG2_NEWKERN_GET_INI1_HEURISTIC 0xD2800015 // Offset of OP + 12 is the INI1 offset.
#define PKG2_NEWKERN_START 0x800 #define PKG2_NEWKERN_START 0x800
u32 pkg2_newkern_ini1_val; extern u32 pkg2_newkern_ini1_val;
u32 pkg2_newkern_ini1_start; extern u32 pkg2_newkern_ini1_start;
u32 pkg2_newkern_ini1_end; extern u32 pkg2_newkern_ini1_end;
typedef struct _kernel_patch_t typedef struct _kernel_patch_t
{ {

View file

@ -27,6 +27,7 @@
#include "../soc/t210.h" #include "../soc/t210.h"
extern volatile nyx_storage_t *nyx_str; extern volatile nyx_storage_t *nyx_str;
void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
u32 minerva_init() u32 minerva_init()
{ {

View file

@ -57,7 +57,7 @@ typedef enum
FREQ_1600 = 1600000 FREQ_1600 = 1600000
} minerva_freq_t; } minerva_freq_t;
void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *); extern void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
u32 minerva_init(); u32 minerva_init();
void minerva_change_freq(minerva_freq_t freq); void minerva_change_freq(minerva_freq_t freq);
void minerva_periodic_training(); void minerva_periodic_training();

View file

@ -29,6 +29,8 @@
#include "../utils/types.h" #include "../utils/types.h"
extern hekate_config h_cfg; extern hekate_config h_cfg;
emummc_cfg_t emu_cfg;
void emummc_load_cfg() void emummc_load_cfg()
{ {

View file

@ -47,7 +47,7 @@ typedef struct _emummc_cfg_t
int fs_ver; int fs_ver;
} emummc_cfg_t; } emummc_cfg_t;
emummc_cfg_t emu_cfg; extern emummc_cfg_t emu_cfg;
void emummc_load_cfg(); void emummc_load_cfg();
bool emummc_set_path(char *path); bool emummc_set_path(char *path);

View file

@ -25,6 +25,11 @@
static bool sd_mounted = false; static bool sd_mounted = false;
static u32 sd_mode = SD_UHS_SDR82; static u32 sd_mode = SD_UHS_SDR82;
sdmmc_t sd_sdmmc;
sdmmc_storage_t sd_storage;
FATFS sd_fs;
u32 sd_get_mode() u32 sd_get_mode()
{ {
return sd_mode; return sd_mode;

View file

@ -30,9 +30,9 @@ enum
SD_UHS_SDR82 = 3, SD_UHS_SDR82 = 3,
}; };
sdmmc_t sd_sdmmc; extern sdmmc_t sd_sdmmc;
sdmmc_storage_t sd_storage; extern sdmmc_storage_t sd_storage;
FATFS sd_fs; extern FATFS sd_fs;
u32 sd_get_mode(); u32 sd_get_mode();
int sd_init_retry(bool power_cycle); int sd_init_retry(bool power_cycle);

View file

@ -21,7 +21,7 @@
#include "../utils/types.h" #include "../utils/types.h"
#include "sdmmc_driver.h" #include "sdmmc_driver.h"
u32 sd_power_cycle_time_start; extern u32 sd_power_cycle_time_start;
typedef enum _sdmmc_type typedef enum _sdmmc_type
{ {

View file

@ -32,6 +32,8 @@
//#define DPRINTF(...) gfx_printf(__VA_ARGS__) //#define DPRINTF(...) gfx_printf(__VA_ARGS__)
#define DPRINTF(...) #define DPRINTF(...)
u32 sd_power_cycle_time_start;
/*! SCMMC controller base addresses. */ /*! SCMMC controller base addresses. */
static const u32 _sdmmc_bases[4] = { static const u32 _sdmmc_bases[4] = {
0x700B0000, 0x700B0000,

View file

@ -59,6 +59,28 @@ extern lv_res_t launch_payload(lv_obj_t *list);
static bool disp_init_done = false; static bool disp_init_done = false;
static bool do_reload = false; static bool do_reload = false;
lv_style_t hint_small_style;
lv_style_t hint_small_style_white;
lv_style_t monospace_text;
lv_obj_t *payload_list;
lv_obj_t *autorcm_btn;
lv_obj_t *close_btn;
lv_img_dsc_t *icon_switch;
lv_img_dsc_t *icon_payload;
lv_img_dsc_t *icon_lakka;
lv_img_dsc_t *hekate_bg;
lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr;
lv_style_t ddlist_transp_bg, ddlist_transp_sel;
lv_style_t tabview_btn_pr, tabview_btn_tgl_pr;
lv_style_t mbox_darken;
char *text_color;
typedef struct _gui_status_bar_ctx typedef struct _gui_status_bar_ctx
{ {
lv_obj_t *mid; lv_obj_t *mid;

View file

@ -34,27 +34,27 @@ typedef struct _emmc_tool_gui_t
bool raw_emummc; bool raw_emummc;
} emmc_tool_gui_t; } emmc_tool_gui_t;
lv_style_t hint_small_style; extern lv_style_t hint_small_style;
lv_style_t hint_small_style_white; extern lv_style_t hint_small_style_white;
lv_style_t monospace_text; extern lv_style_t monospace_text;
lv_obj_t *payload_list; extern lv_obj_t *payload_list;
lv_obj_t *autorcm_btn; extern lv_obj_t *autorcm_btn;
lv_obj_t *close_btn; extern lv_obj_t *close_btn;
lv_img_dsc_t *icon_switch; extern lv_img_dsc_t *icon_switch;
lv_img_dsc_t *icon_payload; extern lv_img_dsc_t *icon_payload;
lv_img_dsc_t *icon_lakka; extern lv_img_dsc_t *icon_lakka;
lv_img_dsc_t *hekate_bg; extern lv_img_dsc_t *hekate_bg;
lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr; extern lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr;
lv_style_t ddlist_transp_bg, ddlist_transp_sel; extern lv_style_t ddlist_transp_bg, ddlist_transp_sel;
lv_style_t tabview_btn_pr, tabview_btn_tgl_pr; extern lv_style_t tabview_btn_pr, tabview_btn_tgl_pr;
lv_style_t mbox_darken; extern lv_style_t mbox_darken;
char *text_color; extern char *text_color;
void reload_nyx(); void reload_nyx();
lv_img_dsc_t *bmp_to_lvimg_obj(const char *path); lv_img_dsc_t *bmp_to_lvimg_obj(const char *path);

View file

@ -39,6 +39,8 @@ extern hekate_config h_cfg;
extern void emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage); extern void emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage);
lv_obj_t *ums_mbox;
typedef struct _emmc_backup_buttons_t typedef struct _emmc_backup_buttons_t
{ {
lv_obj_t *emmc_boot; lv_obj_t *emmc_boot;

View file

@ -19,7 +19,7 @@
#include "../libs/lvgl/lvgl.h" #include "../libs/lvgl/lvgl.h"
lv_obj_t *ums_mbox; extern lv_obj_t *ums_mbox;
void create_tab_tools(lv_theme_t *th, lv_obj_t *parent); void create_tab_tools(lv_theme_t *th, lv_obj_t *parent);
void nyx_run_ums(void *param); void nyx_run_ums(void *param);

View file

@ -19,6 +19,10 @@
#include <string.h> #include <string.h>
#include "gfx.h" #include "gfx.h"
// Global gfx console and context.
gfx_ctxt_t gfx_ctxt;
gfx_con_t gfx_con;
static const u8 _gfx_font[] = { static const u8 _gfx_font[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 032 ( ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 032 ( )
0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x0C, 0x00, // Char 033 (!) 0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x0C, 0x00, // Char 033 (!)

View file

@ -44,7 +44,7 @@ void gfx_set_rect_land_pitch(u32 *fb, const u32 *buf, u32 stride, u32 pos_x, u32
void gfx_set_rect_land_block(u32 *fb, const u32 *buf, u32 pos_x, u32 pos_y, u32 pos_x2, u32 pos_y2); void gfx_set_rect_land_block(u32 *fb, const u32 *buf, u32 pos_x, u32 pos_y, u32 pos_x2, u32 pos_y2);
// Global gfx console and context. // Global gfx console and context.
gfx_ctxt_t gfx_ctxt; extern gfx_ctxt_t gfx_ctxt;
gfx_con_t gfx_con; extern gfx_con_t gfx_con;
#endif #endif

View file

@ -30,6 +30,10 @@
extern const u8 package2_keyseed[]; extern const u8 package2_keyseed[];
u32 pkg2_newkern_ini1_val;
u32 pkg2_newkern_ini1_start;
u32 pkg2_newkern_ini1_end;
/*#include "util.h" /*#include "util.h"
#define DPRINTF(...) gfx_printf(__VA_ARGS__) #define DPRINTF(...) gfx_printf(__VA_ARGS__)
#define DEBUG_PRINTING*/ #define DEBUG_PRINTING*/

View file

@ -30,9 +30,9 @@
#define PKG2_NEWKERN_GET_INI1_HEURISTIC 0xD2800015 // Offset of OP + 12 is the INI1 offset. #define PKG2_NEWKERN_GET_INI1_HEURISTIC 0xD2800015 // Offset of OP + 12 is the INI1 offset.
#define PKG2_NEWKERN_START 0x800 #define PKG2_NEWKERN_START 0x800
u32 pkg2_newkern_ini1_val; extern u32 pkg2_newkern_ini1_val;
u32 pkg2_newkern_ini1_start; extern u32 pkg2_newkern_ini1_start;
u32 pkg2_newkern_ini1_end; extern u32 pkg2_newkern_ini1_end;
typedef struct _pkg2_hdr_t typedef struct _pkg2_hdr_t
{ {

View file

@ -28,6 +28,8 @@
extern volatile nyx_storage_t *nyx_str; extern volatile nyx_storage_t *nyx_str;
void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
u32 minerva_init() u32 minerva_init()
{ {
u32 curr_ram_idx = 0; u32 curr_ram_idx = 0;

View file

@ -57,7 +57,7 @@ typedef enum
FREQ_1600 = 1600000 FREQ_1600 = 1600000
} minerva_freq_t; } minerva_freq_t;
void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *); extern void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
u32 minerva_init(); u32 minerva_init();
void minerva_change_freq(minerva_freq_t freq); void minerva_change_freq(minerva_freq_t freq);
void minerva_periodic_training(); void minerva_periodic_training();

View file

@ -21,6 +21,10 @@
#include "../mem/heap.h" #include "../mem/heap.h"
#include "../utils/list.h" #include "../utils/list.h"
sdmmc_t emmc_sdmmc;
sdmmc_storage_t emmc_storage;
FATFS emmc_fs;
void nx_emmc_gpt_parse(link_t *gpt, sdmmc_storage_t *storage) void nx_emmc_gpt_parse(link_t *gpt, sdmmc_storage_t *storage)
{ {
gpt_t *gpt_buf = (gpt_t *)calloc(NX_GPT_NUM_BLOCKS, NX_EMMC_BLOCKSIZE); gpt_t *gpt_buf = (gpt_t *)calloc(NX_GPT_NUM_BLOCKS, NX_EMMC_BLOCKSIZE);

View file

@ -36,9 +36,9 @@ typedef struct _emmc_part_t
link_t link; link_t link;
} emmc_part_t; } emmc_part_t;
sdmmc_t emmc_sdmmc; extern sdmmc_t emmc_sdmmc;
sdmmc_storage_t emmc_storage; extern sdmmc_storage_t emmc_storage;
FATFS emmc_fs; extern FATFS emmc_fs;
void nx_emmc_gpt_parse(link_t *gpt, sdmmc_storage_t *storage); void nx_emmc_gpt_parse(link_t *gpt, sdmmc_storage_t *storage);
void nx_emmc_gpt_free(link_t *gpt); void nx_emmc_gpt_free(link_t *gpt);

View file

@ -27,6 +27,10 @@ static bool sd_init_done = false;
static u16 sd_errors[3] = { 0 }; // Init and Read/Write errors. static u16 sd_errors[3] = { 0 }; // Init and Read/Write errors.
static u32 sd_mode = SD_UHS_SDR104; static u32 sd_mode = SD_UHS_SDR104;
sdmmc_t sd_sdmmc;
sdmmc_storage_t sd_storage;
FATFS sd_fs;
void sd_error_count_increment(u8 type) void sd_error_count_increment(u8 type)
{ {
switch (type) switch (type)

View file

@ -38,9 +38,9 @@ enum
SD_ERROR_RW_RETRY = 2 SD_ERROR_RW_RETRY = 2
}; };
sdmmc_t sd_sdmmc; extern sdmmc_t sd_sdmmc;
sdmmc_storage_t sd_storage; extern sdmmc_storage_t sd_storage;
FATFS sd_fs; extern FATFS sd_fs;
void sd_error_count_increment(u8 type); void sd_error_count_increment(u8 type);
u16 *sd_get_error_count(); u16 *sd_get_error_count();

View file

@ -28,6 +28,8 @@
//#define DPRINTF(...) gfx_printf(__VA_ARGS__) //#define DPRINTF(...) gfx_printf(__VA_ARGS__)
#define DPRINTF(...) #define DPRINTF(...)
u32 sd_power_cycle_time_start;
static inline u32 unstuff_bits(u32 *resp, u32 start, u32 size) static inline u32 unstuff_bits(u32 *resp, u32 start, u32 size)
{ {
const u32 mask = (size < 32 ? 1 << size : 0) - 1; const u32 mask = (size < 32 ? 1 << size : 0) - 1;

View file

@ -21,7 +21,7 @@
#include "../utils/types.h" #include "../utils/types.h"
#include "sdmmc_driver.h" #include "sdmmc_driver.h"
u32 sd_power_cycle_time_start; extern u32 sd_power_cycle_time_start;
typedef enum _sdmmc_type typedef enum _sdmmc_type
{ {