Skip to content

Msvc build fix #1034

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

Merged
merged 3 commits into from
Jan 2, 2015
Merged

Msvc build fix #1034

merged 3 commits into from
Jan 2, 2015

Conversation

stinos
Copy link
Contributor

@stinos stinos commented Jan 2, 2015

Fix msvc build, some cleanup in the msbuild files

  • use correct include directory when invoking preprocessor for qstrdefs.h since that now has #include "py/mpconfig.h" instead of just ```mpconfig.h`
  • compile/link mp_arg_error_terse_mismatch function no matter what MICROPY_ERROR_REPORTING is set to

stinos added 3 commits January 2, 2015 16:52
- Use a single file env.props for defining the main directories used when building.
  env.props resolves the base directory and defines overridable output directories,
  and is used by all other build files.
- Fix the build currently failing, basically because the preprocessing command for generating
  qstrdefs uses different include directories than the build itself does.
  (specifically, qstrdefs.h uses #include "py/mpconfig.h" since the fixes for micropython#1022
  in 51dfcb4, so we need to use the base directory as include directory, not the py dir itself).
  So define a single variable containing the include directories instead and use it where needed.
The compiler treats `if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE)` as
a normal statement and generates assembly for it in degug mode as if MICROPY_ERROR_REPORTING
is an actual symbol instead of a preprocessor definition.
As such linking fails because mp_arg_error_terse_mismatch is not defined when
MICROPY_ERROR_REPORTING_TERSE is detailed or normal.
Remove some duplication in the code for generating
qstrdefs.generated.h and py-version.h
@@ -139,7 +139,7 @@ void mp_arg_parse_all_kw_array(mp_uint_t n_pos, mp_uint_t n_kw, const mp_obj_t *
mp_arg_parse_all(n_pos, args, &kw_args, n_allowed, allowed, out_vals);
}

#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE || _MSC_VER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange that it needs this... even with no optimisation and debugging enabled, unix version doesn't complain about mp_arg_error_terse_mismatch not existing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be a gcc optimization. In debug mode cl compiles if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) into xor eax,eax followed by a jump which is always skipped of course. In release mode it gets rid of everything, yet still wants the function definition to be available. Might be a bug or 'feature'

@dpgeorge dpgeorge merged commit ffc96a9 into micropython:master Jan 2, 2015
@stinos stinos deleted the msvc-build-fix branch January 2, 2015 20:14
tannewt added a commit to tannewt/circuitpython that referenced this pull request Dec 6, 2018
This creates a common safe mode mechanic that ports can share.
As a result, the nRF52 now has safe mode support as well.

The common safe mode adds a 700ms delay at startup where a reset
during that window will cause a reset into safe mode. This window
is designated by a yellow status pixel and flashing the single led
three times.

A couple NeoPixel fixes are included for the nRF52 as well.

Fixes micropython#1034. Fixes micropython#990. Fixes micropython#615.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants