tomtor / ulp-i2c

Esp32 ULP I2C code and bmp180 example
GNU Lesser General Public License v3.0
99 stars 18 forks source link

ret macro works strange in my code. #1

Closed Pines closed 7 years ago

Pines commented 7 years ago

i use stack in my code

  1. include stack.s in main.s
  2. alloc 100 in .bss of main.s
  3. move r3, stack end (right after entry)
  4. then call a subroutine (only set/clear gpio for debug) with ret at subroutine end. after calling jump subroutine, the following code wont be executed, so by now i gess ret jump to a wrong address. i wonder could it be ulp compile version or setting up problem cause my ret work not correct.

by the way thank you sir, your work is like lighting up a tower in the ocean.

Pines commented 7 years ago

i may not make that clear, code in subroutine run correct. but after call ret, it cant go back run code next where suntoutine called

tomtor commented 7 years ago

See https://www.esp32.com/viewtopic.php?f=2&t=3228

You need a patch for the assembler, the jump rx command produces wrong code.

Espressif has not made new toolchain binairies available for download yet, so you will have to build them yourself. This is easy on Linux (see link to forum), but a bit more work on Windows.

Pines commented 7 years ago

ok, thank you so much

Pines commented 7 years ago

Hi, sir again.

i'm build this ulp compile tools myself on win7 under mingw32, and with no luck. make fail looks like cant find correct io.h fcntl.h

did you build it with windows, ... and how to do that

tomtor commented 7 years ago

I created a build with msys2 on a Windows-7 32-bit installation:

https://drive.google.com/open?id=0B3Q0BNAaAVQzV0JxWkpNU3ZVZjg

Also tested the as executable on a Windows-10 64 bit installation.

I installed the msys2 compiler with:

pacman -S --needed base-devel mingw-w64-i686-toolchain

See also:

https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2

Pines commented 7 years ago

OK, thank you.

Pines commented 7 years ago

I'm in china, and now is morning, I build a demo with this ulp tools-chain, and stack, i2c.s i2c-util.s finally have good i2c communication with mpu6050 sensor.

I'm very exciting, this hard I2C left shift 1 bit thing trouble me for a week. i'll try do a little math dealing with data from mpu6050, that will be my goal.

Thank you Sir, answer my question. this ulp i2c tools is helpful. (5 star)