1
0
mirror of https://github.com/marqs85/ossc.git synced 2024-12-28 18:29:28 +00:00

fix debug mode printf

This commit is contained in:
marqs 2018-10-20 23:55:52 +03:00
parent 0905620b4d
commit 525c08a777
10 changed files with 7537 additions and 7483 deletions

View File

@ -134,7 +134,8 @@
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="yes">
<Target Name="diy-audio-debug">make ENABLE_AUDIO=y APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex</Target>
<Target Name="compile_image_debug">make APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex</Target>
<Target Name="compile_image_aud-debug">make ENABLE_AUDIO=y APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex</Target>
<Target Name="Ack BSP update">cd ../sys_controller_bsp &amp;&amp; touch public.mk Makefile</Target>
<RebuildCommand/>
<CleanCommand>make clean</CleanCommand>

File diff suppressed because it is too large Load Diff

View File

@ -78,6 +78,7 @@ avinput_t target_input;
alt_u8 pcm1862_active;
alt_u32 read_it2(alt_u32 regaddr);
inline void lcd_write_menu()
{

View File

@ -90,15 +90,6 @@ static int check_fw_image(alt_u32 offset, alt_u32 size, alt_u32 golden_crc, alt_
return 0;
}
#ifdef DEBUG
int fw_update()
{
sniprintf(menu_row2, LCD_ROW_LEN+1, "Unavailable");
lcd_write_menu();
usleep(1000000);
return -1;
}
#else
int fw_update()
{
int retval, i;
@ -234,4 +225,3 @@ failure:
return -1;
}
#endif

View File

@ -179,10 +179,12 @@ MENU(menu_settings, P99_PROTECT({ \
{ LNG("<Reset settings>","<セッテイオショキカ >"), OPT_FUNC_CALL, { .fun = { set_default_avconfig, NULL } } },
{ LNG("Link prof->input","Link prof->input"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.link_av, OPT_WRAP, AV1_RGBs, AV_LAST, link_av_desc } } },
{ LNG("Link input->prof","Link input->prof"), OPT_AVCONFIG_SELECTION, { .sel = { &profile_link, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ "<Import sett. >", OPT_FUNC_CALL, { .fun = { import_userdata, NULL } } },
{ LNG("Initial input","ショキニュウリョク"), OPT_AVCONFIG_SELECTION, { .sel = { &def_input, OPT_WRAP, SETTING_ITEM(avinput_str) } } },
{ "LCD BL timeout", OPT_AVCONFIG_SELECTION, { .sel = { &lcd_bl_timeout, OPT_WRAP, SETTING_ITEM(lcd_bl_timeout_desc) } } },
#ifndef DEBUG
{ "<Import sett. >", OPT_FUNC_CALL, { .fun = { import_userdata, NULL } } },
{ LNG("<Fw. update >","<ファームウェアアップデート>"), OPT_FUNC_CALL, { .fun = { fw_update, NULL } } },
#endif
}))

View File

@ -30,10 +30,12 @@
#define printf(...)
#else
#include <stdio.h>
#include "utils.h"
#define OS_PRINTF printf
#define ErrorF printf
// use reduced printf
//#define printf alt_printf
#define printf dd_printf
#endif
#define WAITLOOP_SLEEP_US 10000

View File

@ -17,8 +17,12 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#include <stdio.h>
#include <stdarg.h>
#include "sys/alt_stdio.h"
#include "utils.h"
#include "system.h"
#include "sysconfig.h"
#include "io.h"
alt_u32 bswap32(alt_u32 w)
@ -72,3 +76,18 @@ unsigned long crc32(unsigned char *input_data, unsigned long input_data_length,
*/
return IORD_32DIRECT(HW_CRC32_0_BASE, 0x10);
}
/* printf for direct driver interface */
int dd_printf(const char *__restrict fmt, ...) {
int ret;
va_list ap;
char buf[PRINTF_BUFSIZE];
va_start(ap, fmt);
ret = vsnprintf(buf, PRINTF_BUFSIZE, fmt, ap);
va_end(ap);
if (ret > 0)
alt_putstr(buf);
return 0;
}

View File

@ -22,10 +22,14 @@
#include <alt_types.h>
#define PRINTF_BUFSIZE 512
unsigned char bitswap8(unsigned char v);
alt_u32 bswap32(alt_u32 w);
unsigned long crc32(unsigned char *input_data, unsigned long input_data_length, int do_initialize);
int dd_printf(const char *__restrict fmt, ...);
#endif

View File

@ -238,6 +238,9 @@ altera_nios2_gen2_hal_driver_SRCS_ROOT := HAL
# altera_nios2_gen2_hal_driver sources
altera_nios2_gen2_hal_driver_C_LIB_SRCS := \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_usleep.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_printf.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_putchar.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_putstr.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_busy_sleep.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_ecc_fatal_exception.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_instruction_exception_entry.c \