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

improve hard fault message #8297

Merged
merged 2 commits into from
Aug 20, 2023
Merged
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
43 changes: 18 additions & 25 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ msgstr ""
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"Please file an issue with your program at https://github.com/adafruit/"
"circuitpython/issues."
"Please file an issue with your program at github.com/adafruit/circuitpython/"
"issues."
msgstr ""

#: supervisor/shared/safe_mode.c
Expand Down Expand Up @@ -182,6 +182,7 @@ msgid "%q must be 1 when %q is True"
msgstr ""

#: py/argcheck.c shared-bindings/gifio/GifWriter.c
#: shared-module/gifio/OnDiskGif.c
msgid "%q must be <= %d"
msgstr ""

Expand Down Expand Up @@ -632,11 +633,6 @@ msgstr ""
msgid "Buffer is not a bytearray."
msgstr ""

#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c
#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""

#: ports/stm/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
Expand All @@ -656,6 +652,12 @@ msgstr ""
msgid "Buffer too short by %d bytes"
msgstr ""

#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c
#: shared-bindings/framebufferio/FramebufferDisplay.c
#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c
msgid "Buffer too small"
msgstr ""

#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c
msgid "Buffers must be same size"
msgstr ""
Expand Down Expand Up @@ -1006,10 +1008,6 @@ msgstr ""
msgid "Failed to write internal flash."
msgstr ""

#: supervisor/shared/safe_mode.c
msgid "Fault detected by hardware."
msgstr ""

#: py/moduerrno.c
msgid "File exists"
msgstr ""
Expand Down Expand Up @@ -1085,6 +1083,10 @@ msgstr ""
msgid "Half duplex SPI is not implemented"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid "Hard fault: memory access or instruction error."
msgstr ""

#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c
#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c
#: ports/stm/common-hal/sdioio/SDCard.c
Expand Down Expand Up @@ -1785,6 +1787,10 @@ msgstr ""
msgid "Polygon needs at least 3 points"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid "Power dipped. Make sure you are providing enough power."
msgstr ""

#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
Expand Down Expand Up @@ -1950,10 +1956,6 @@ msgstr ""
msgid "Size not supported"
msgstr ""

#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""

#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
Expand Down Expand Up @@ -2019,10 +2021,6 @@ msgstr ""
msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid "The power dipped. Make sure you are providing enough power."
msgstr ""

#: shared-module/audiomixer/MixerVoice.c
msgid "The sample's bits_per_sample does not match the mixer's"
msgstr ""
Expand Down Expand Up @@ -2608,8 +2606,7 @@ msgstr ""
msgid "buffer slices must be of equal length"
msgstr ""

#: py/modstruct.c shared-bindings/struct/__init__.c
#: shared-module/struct/__init__.c
#: py/modstruct.c shared-module/struct/__init__.c
msgid "buffer too small"
msgstr ""

Expand Down Expand Up @@ -3866,10 +3863,6 @@ msgstr ""
msgid "pixel coordinates out of bounds"
msgstr ""

#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
msgstr ""

#: extmod/vfs_posix_file.c
msgid "poll on file not available on win32"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion ports/cxd56/common-hal/camera/Camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ size_t common_hal_camera_take_picture(camera_obj_t *self, uint8_t *buffer, size_
mp_raise_ValueError(translate("Size not supported"));
}
if (!camera_check_buffer_length(width, height, format, len)) {
mp_raise_ValueError(translate("Buffer is too small"));
mp_raise_ValueError(translate("Buffer too small"));
}
if (!camera_check_format(format)) {
mp_raise_ValueError(translate("Format not supported"));
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/displayio/Display.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po
displayio_display_core_fill_area(&self->core, &area, mask, result_buffer);
return result;
} else {
mp_raise_ValueError(translate("Buffer is too small"));
mp_raise_ValueError(translate("Buffer too small"));
}
}
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_fill_row_obj, 1, displayio_display_obj_fill_row);
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/displayio/TileGrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_pixel_shader_obj, displayio_til
STATIC mp_obj_t displayio_tilegrid_obj_set_pixel_shader(mp_obj_t self_in, mp_obj_t pixel_shader) {
displayio_tilegrid_t *self = native_tilegrid(self_in);
if (!mp_obj_is_type(pixel_shader, &displayio_palette_type) && !mp_obj_is_type(pixel_shader, &displayio_colorconverter_type)) {
mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter"));
mp_raise_TypeError_varg(translate("unsupported %q type"), MP_QSTR_pixel_shader);
}

common_hal_displayio_tilegrid_set_pixel_shader(self, pixel_shader);
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/framebufferio/FramebufferDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, con
displayio_display_core_fill_area(&self->core, &area, mask, result_buffer);
return result;
} else {
mp_raise_ValueError(translate("Buffer is too small"));
mp_raise_ValueError(translate("Buffer too small"));
}
}
MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, framebufferio_framebufferdisplay_obj_fill_row);
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/struct/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) {
// negative offsets are relative to the end of the buffer
offset = (mp_int_t)bufinfo.len + offset;
if (offset < 0) {
mp_raise_RuntimeError(translate("buffer too small"));
mp_raise_RuntimeError(translate("Buffer too small"));
}
}
byte *p = (byte *)bufinfo.buf;
Expand Down Expand Up @@ -151,7 +151,7 @@ STATIC mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *pos_args, mp_m
// negative offsets are relative to the end of the buffer
offset = bufinfo.len + offset;
if (offset < 0) {
mp_raise_RuntimeError(translate("buffer too small"));
mp_raise_RuntimeError(translate("Buffer too small"));
}
}
p += offset;
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/vectorio/VectorShape.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ STATIC mp_obj_t vectorio_vector_shape_obj_set_pixel_shader(mp_obj_t wrapper_shap
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));

if (!mp_obj_is_type(pixel_shader, &displayio_palette_type) && !mp_obj_is_type(pixel_shader, &displayio_colorconverter_type)) {
mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter"));
mp_raise_TypeError_varg(translate("unsupported %q type"), MP_QSTR_pixel_shader);
}

common_hal_vectorio_vector_shape_set_pixel_shader(self, pixel_shader);
Expand Down
2 changes: 1 addition & 1 deletion shared-module/struct/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void shared_modules_struct_pack_into(mp_obj_t fmt_in, byte *p, byte *end_p, size
const mp_uint_t total_sz = shared_modules_struct_calcsize(fmt_in);

if (p + total_sz > end_p) {
mp_raise_RuntimeError(translate("buffer too small"));
mp_raise_RuntimeError(translate("Buffer too small"));
}

size_t i = 0;
Expand Down
6 changes: 3 additions & 3 deletions supervisor/shared/safe_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void print_safe_mode_message(safe_mode_t reason) {

switch (reason) {
case SAFE_MODE_BROWNOUT:
message = translate("The power dipped. Make sure you are providing enough power.");
message = translate("Power dipped. Make sure you are providing enough power.");
break;
case SAFE_MODE_USER:
#if defined(BOARD_USER_SAFE_MODE_ACTION)
Expand Down Expand Up @@ -209,7 +209,7 @@ void print_safe_mode_message(safe_mode_t reason) {
message = translate("Failed to write internal flash.");
break;
case SAFE_MODE_HARD_FAULT:
message = translate("Fault detected by hardware.");
message = translate("Hard fault: memory access or instruction error.");
break;
case SAFE_MODE_INTERRUPT_ERROR:
message = translate("Interrupt error.");
Expand All @@ -228,7 +228,7 @@ void print_safe_mode_message(safe_mode_t reason) {
break;
}
serial_write_compressed(message);
serial_write_compressed(translate("\nPlease file an issue with your program at https://github.com/adafruit/circuitpython/issues."));
serial_write_compressed(translate("\nPlease file an issue with your program at github.com/adafruit/circuitpython/issues."));
}

// Always tell user how to get out of safe mode.
Expand Down