Using nasm-3.01 on following file (command: nasm -fwin32 -w+error test.asm -o test.obj -l test.lst)
segment .text code use16
test:
BITS 16
        o32     ret
BITS 32
        o16     ret
.end:
I have to turn off -w+error to compile system management mode interrupt service routine function.