Skip to content

Commit

Permalink
Merge branch 'bugfix/esp_rom_const_correctness' into 'master'
Browse files Browse the repository at this point in the history
esp_rom: Fixed writable string issue on Linux implementation

Closes IDF-6187

See merge request espressif/esp-idf!20925
  • Loading branch information
zikalino committed Nov 4, 2022
2 parents 6b213b2 + 44aa3c3 commit 8184f03
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
1 change: 1 addition & 0 deletions components/esp_rom/host_test/rom_test/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONFIG_IDF_TARGET="linux"
CONFIG_COMPILER_CXX_EXCEPTIONS=y
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n
CONFIG_COMPILER_WARN_WRITE_STRINGS=y
23 changes: 8 additions & 15 deletions components/esp_rom/linux/esp_rom_sys.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <stdio.h>
#include <stdlib.h>
Expand All @@ -30,7 +22,7 @@ static void call_linux_putc(char c) {

#define is_digit(c) ((c >= '0') && (c <= '9'))

static int _cvt(unsigned long long val, char *buf, long radix, char *digits)
static int _cvt(unsigned long long val, char *buf, long radix, const char *digits)
{
#ifdef SUPPORT_LITTLE_RADIX
char temp[64];
Expand Down Expand Up @@ -65,7 +57,8 @@ static int esp_rom_vprintf(void (*putc)(char c), const char *fmt, va_list ap)
#else
char buf[32];
#endif
char c, sign, *cp=buf;
char c, sign;
const char *cp = buf;
int left_prec, right_prec, zero_fill, pad, pad_on_right,
islong, islonglong;
long long val = 0;
Expand Down
1 change: 1 addition & 0 deletions components/log/host_test/log_test/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CONFIG_IDF_TARGET="linux"
CONFIG_COMPILER_CXX_EXCEPTIONS=y
CONFIG_COMPILER_WARN_WRITE_STRINGS=y
CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=y
CONFIG_LOG_DEFAULT_LEVEL=5
Expand Down
1 change: 0 additions & 1 deletion tools/ci/check_copyright_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ components/esp_rom/include/esp_rom_uart.h
components/esp_rom/include/linux/soc/reset_reasons.h
components/esp_rom/linux/esp_rom_crc.c
components/esp_rom/linux/esp_rom_md5.c
components/esp_rom/linux/esp_rom_sys.c
components/esp_rom/patches/esp_rom_crc.c
components/esp_rom/patches/esp_rom_tjpgd.c
components/esp_rom/test/test_libgcc.c
Expand Down

0 comments on commit 8184f03

Please sign in to comment.