RetroBSD

2.11BSD operating system for microcontrollers
It is currently Mon Sep 24, 2018 11:00 pm

All times are UTC




Post new topic Reply to topic  [ 40 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sun Oct 04, 2015 3:54 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
fyi - hopefully it does not harm:
Code:
pito@UBU1404://home/pito/Retronew/retrobsd$ time make > out.txt
byacc: 6 reduce/reduce conflicts.
awk.g.y: warning: 96 shift/reduce conflicts [-Wconflicts-sr]
byacc: 20 shift/reduce conflicts, 23 reduce/reduce conflicts.
byacc: 12 shift/reduce conflicts, 30 reduce/reduce conflicts.
byacc: 2 shift/reduce conflicts.
cat.1:30: warning: macro `ti+15n' not defined (possibly missing space after `ti')
cat.1:35: warning: macro `ti+15n' not defined (possibly missing space after `ti')
cmp.1:39: can't set diversion trap when no current diversion
warning: eqn should have been given a `-Tascii' option
eqn.1:160: warning: can't find special character `sqrt'
eqn.1:189: warning: can't find special character `sqrtex'
eqn.1:205: warning: can't find special character `a.'
eqn.1:282: warning: can't find special character `bs'
m4.1:203: can't set diversion trap when no current diversion
pi.1:82: can't set diversion trap when no current diversion
pi.1:122: warning: numeric expression expected (got `c')
ecvt.3:39: warning: can't find special character `*_'
getdisk.3:31: can't open `/usr/include/sys/disklabel.h': No such file or directory
sin.3:54: warning: macro `Pi.' not defined (possibly missing space after `Pi')
sysctl.3:445: warning: numeric expression expected (got a space)
time.3:48: can't open `/usr/include/sys/timeb.h': No such file or directory
times.3:35: can't open `/usr/include/sys/times.h': No such file or directory
L.sys.5:383: warning: numeric expression expected (got `n')
acct.5:19: can't open `/usr/include/sys/acct.h': No such file or directory
dbx.5:134: warning: macro `need' not defined (possibly missing space after `ne')
dtab.5:45: can't set diversion trap when no current diversion
map3270.5:229: warning: can't find special character `';'
termcap.5:68: environment stack underflow
termcap.5:85: environment stack underflow
termcap.5:93: environment stack underflow
termcap.5:102: environment stack underflow
types.5:20: can't open `/usr/include/sys/types.h': No such file or directory
vgrindefs.5:47: `\e' is not allowed in an escape name
vgrindefs.5:47: warning: can't find special character `'

real   2m52.429s
user   2m9.936s
sys   0m15.356s
pito@UBU1404://home/pito/Retronew/retrobsd$

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun Oct 04, 2015 4:09 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Mostly relating to converting man pages and things. You can ignore them all.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sun Oct 04, 2015 4:31 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
I started to build by myself again :).
Some thoughts from watching the new configs:

1.
Code:
options         "CPU_KHZ=80000"             # Oscillator frequency of CPU core
options         "BUS_KHZ=80000"             # Frequency of peripheral bus
options         "BUS_DIV=1"                 # Bus clock divisor 1/2/4/8

I would leave CPU_KHZ and BUS_DIV only (and calculate BUS_KHZ).

2.
When building barebone (so the cpu clock inits from devcfg.c) there is no relationship between above and the bits in the devcfg.c, thus I would mention that in config.
The same with standard boards - I would mention the clock settings actually come from bootloader, so you cannot change that in config as you may wish.

3. Also the sdcard's spi freq depends on the above, so it seems a feasibility check would be nice to have in the future :) , or, instead of "SD_MHZ=20" enter only the SPI divisor.
BTW - I did new unix.hex with "SD_MHZ=20" @80MHz
Code:
# SPI ports
controller      spi2                        # SD card
controller      spi3                        # Pins RD1, RD2, RD3

# microSD card
device          sd0     at spi2 pin RG9     # select pin
options         "SD_MHZ=20"                 # speed 20 MHz

and the splash screen shows
Code:
sd0: type SDHC, size 3872256 kbytes, speed 13 Mbit/sec


4. Similar with uart speeds - would be great to have option for the baudrate (if does not exist already) and the check as well, whether it fits..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun Oct 04, 2015 5:34 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
1. Those settings are to tell the kernel how fast the chip is running.

2. This controls the chip. The kernel can't know what speed crystal you have attached, so it can't know what to calculate as - hence there is no connection between devcfg's settings and the kernel's clock setting.

3. The SPI setting attempts a "closest match" setting using what is specified in the peripheral bus setting. If your peripheral bus is slower than the desired SPI frequency you end up with a lower frequency. It makes no assumption about what is possible, and who knows what may be possible in future chips for different clock frequencies - maybe they will come up with a fractional division, or an SPI PLL, for completely different frequencies. The given frequency is more of a suggestion of what you'd like, not telling the kernel what it will be.

4. It should be possible to change the baud rate, but again, it's merely a hint to say what you'd like. It's rare to get the exact value unless you run the chip from a "baud rate" crystal.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sun Oct 04, 2015 5:44 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
1,2,3,4 - we know that well :), we have to tell to the kernel what is the freq, AND, set the bits such the frequency is there. BTW 20MHz SPI is an allowed freq @80MHz, so it seems the option is being ignored in this config version.

PS: I did it as the kernel build only:
Code:
make reconfig
make

in fubarino directory, and now it shows 20MHz speed (and it is faster)..
Hmm, I think I did a complete build before.. Or did not? :? Sure I did..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Tue Oct 06, 2015 6:38 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
When changing Baudrate in Config (baremetal), for example:
Code:
# Console options
options         "CONS_MAJOR=UART_MAJOR"     # UART device
options         "CONS_MINOR=0"              # /dev/tty0
options         "CONS_BAUD=19200"

do I need to change something in /etc/ttys ??
(The documentation says I have to have there:
Code:
console "/libexec/getty std.19200"     vt100   on secure       #special

but I do not see the default std.115200 settings there..)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Tue Oct 06, 2015 7:15 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
Looks like std.default should work for any baud rate.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 8:10 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Hmm, I've flashed my fubarino barebone
Code:
#
# Custom board with UART console
# ==============================
# Console on UART2.
#
# To build the kernel, use:
#   cd sys/pic32/baremetal
#   kconfig Config
#   make clean
#   make
#
# Format of this file is described on page:
# http://retrobsd.org/wiki/doku.php/doc/kconfig
#
architecture    "pic32"
cpu             "PIC32MX7"                  # Processor variant
board           "BAREMETAL"                 # Board type
ldscript        "baremetal/script.ld"       # Linker script

# Standard system options
options         "CPU_KHZ=8000"             # Oscillator frequency of CPU core
options         "BUS_KHZ=8000"             # Frequency of peripheral bus
options         "BUS_DIV=1"                 # Bus clock divisor 1/2/4/8

# Button
# Hold this button pressed at startup to enter single-user mode.
#signal          "BUTTON1"   pin RE7 invert  # PRG button, active low

# LEDs
signal          "LED_KERNEL"    pin RE5     # kernel activity indicator
#signal          "LED_DISK"      pin RD2     # disk activity indicator
#signal          "LED_TTY"       pin RD12    # tty activity indicator

# Root filesystem at /dev/sd0a, swap at /dev/sd0b
config          unix    root on sd0a
                        swap on sd0b

# Serial UART ports
device          uart2

# Console options
options         "CONS_MAJOR=UART_MAJOR"     # UART device
options         "CONS_MINOR=1"              # /dev/tty1
options      "CONS_BAUD=19200"

# UART ports
#device          uart2                       # Pins RF4, RF5

# SPI ports
controller      spi2                        # SD card
#controller      spi3                        # Pins RD1, RD2, RD3

# microSD card
device          sd0     at spi2 pin RG9     # select pin
options         "SD_MHZ=4"                 # speed XX MHz

# General purpose I/O ports
# Flags define a mask of available pins
# The following pins excluded:
#   RG6, RG7, RG8, RG9 - spi2, SD card
#   RD1, RD2, RD3      - spi3
#   RF4, RF5           - uart2
device          gpio1   flags 0xffff    # port B
device          gpio2   flags 0xf000    # port C
device          gpio3   flags 0x0ff1    # port D
device          gpio4   flags 0x00ff    # port E
device          gpio5   flags 0x000b    # port F
device          gpio6   flags 0x000c    # port G

# ADC driver
device          adc

# PWM driver
device          pwm

Code:
/*
 * Chip configuration.
 */
#include "machine/pic32mx.h"

PIC32_DEVCFG (
    DEVCFG0_DEBUG_DISABLED,     /* ICE debugger enabled */

    DEVCFG1_POSCMOD_HS |      /* 8MHz crystal */
    DEVCFG1_FPBDIV_1 |          /* Peripheral bus clock = SYSCLK/1 */
    DEVCFG1_FCKM_DISABLE |      /* Fail-safe clock monitor disable */
    DEVCFG1_FCKS_DISABLE |      /* Clock switching disable */
    DEVCFG1_WDTPS_128,            /* Watchdog postscale = 1/128 */

    DEVCFG2_FPLLIDIV_2 |        /* PLL divider = 1/2 */
    DEVCFG2_FPLLMUL_20 |        /* PLL multiplier = 20x */
    DEVCFG2_UPLLIDIV_2 |        /* USB PLL divider = 1/2 */
    DEVCFG2_UPLLDIS |           /* Disable USB PLL */
    DEVCFG2_FPLLODIV_1,         /* PLL postscaler = 1/1 */

    DEVCFG3_USERID(0xffff) |    /* User-defined ID */
    DEVCFG3_FSRSSEL_7 |         /* Assign irq priority 7 to shadow set */
    DEVCFG3_FETHIO);            /* Default Ethernet i/o pins */

but the best print I can get is>
Code:
²®±±  ®©¸ ¦¯²   ³²¬ ²¥¶©³©¯® ³¹´ ¢µ©¬¤ ±°º
     ¯­°©¬¥¤ ²°±µ­±°­°· ¢¹ °©´¯±´°´º
     ¯¯¨¯­¥¯°©´¯¯¥´²¯®¥·¯²¥´²¯¢³¤¯³¹³¯°©£³²¯¢¡²¥­¥´¡¬
º¬ ¢µ³ ¸ ± ¸ 
¯³£©¬¬¡´¯²º ©®´¥²®¡¬ ¡³´ 
³°©²º °©®³ ³¤©½·¯³¤¯½¸¯³£«½¶
µ¡²´²º °©®³ ²¸½´¯´¸½µ¬ ©®´¥²²µ°´³ ´°¯´±¯´²¬ £¯®³¯¬¥
³¤°º °¯²´       ²¬ °©® £³½¹
§°©¯±º °¯²´¬ °©®³ ©©©©©©©©©©©©©©©©
§°©¯²º °¯²´¬ °©®³ ©©©©­­­­­­­­­­­­
§°©¯³º °¯²´¬ °©®³ ­­­­©©©©©©©©­­­©
§°©¯´º °¯²´¬ °©®³ ­­­­­­­­©©¯©©©©©
§°©¯µº °¯²´¬ °©®³ ­­­­­­­­­­­­©­©©
§°©¯¶º °¯²´¬ °©®³ ­­­­­­­­­­­­©©­­
¡¤£º ±µ £¨¡®®¥¬³
°·­º µ £¨¡®®¥¬³
 £¡²¤ ¤¥´¥£´¥¤
°¡®©£º ¯ ²¯¯´ ¦©¬¥³¹³´¥­ ¦¯µ®¤¡
®¯ ¦³ ¯® ¤¥¶ °¯±
³¹®£©®§ ¤©³«³®®® ¤¯®¥
¨¡¬´¥¤

at 115k2. It means the stuff still works on 115200, but not precise baudrate at 8MHz (125k), therefore it prints out above wellknown pattern during splash.
Now, how to get 19200 (19231 at 8MHz)?

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 8:17 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
Do you really want CPU_KHZ=8000?
In this case the DEVCFG dividers should be modified to get a desired frequency.

Currently the uart driver tries to set 19200 assuming BUS_KHZ=8000, but the processor really runs at BUS_KHZ=80000, so you have something like 192000 baud.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 8:22 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Nope, CPU runs at 8MHz.. I can see it on the kernel activity led.. :)
PLL is off.
Moreover, you will not get your welcome screen at 192kbaud in such nice shape :)
PS> no sdcard inserted yet.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 8:33 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
OK, I see.
But there is no such parameter as CONS_BAUD.
Use UART_BAUD instead.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 8:47 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
:lol:
Code:
2.11 BSD Unix for PIC32, revision G394 build 11:
     Compiled 2015-10-07 by pito@UBU1404:
     //home/pito/Retronew/retrobsd/sys/pic32/baremetal
cpu: 795F512H 8 MHz, bus 8 MHz
oscillator: internal Fast RC
spi2: pins sdi=RG7/sdo=RG8/sck=RG6
uart2: pins rx=RF4/tx=RF5, interrupts 40/41/42, console
sd0: port SPI2, pin cs=RG9
gpio1: portB, pins iiiiiiiiiiiiiiii
gpio2: portC, pins iiii------------
gpio3: portD, pins ----iiiiiiii---i
gpio4: portE, pins --------iioiiiii
gpio5: portF, pins ------------i-ii
gpio6: portG, pins ------------ii--
adc: 15 channels
pwm: 5 channels
sd0: no SD/MMC card detected
panic: No root filesystem found!
no fs on dev 0/1
syncing disks... done
halted

BTW what if you have two uarts?? :)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 9:08 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
Perfect!
At startup, all uarts are preinitialized to UART_BAUD speed. For non-console uarts, you can set the desired speed in /etc/ttys file.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 9:09 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Code:
# ls
Makefile     hello.c      primesum.c   skeleton.c   test2.c      tft.c
adc.c        lcd6.c       q8.c         stdarg.c     test3.c      tftetris.c
gpio.c       primelist.c  rain.c       test1.c      tetris.c
# time make
cc  -o hello  hello.c
cc  -o stdarg  stdarg.c
cc  -o skeleton  skeleton.c
cc  -o primelist  primelist.c
cc  -o primesum  primesum.c
cc  -o test1  test1.c
cc  -o test2  test2.c
cc  -o test3  test3.c
cc  -o gpio  gpio.c
cc  -o adc  adc.c
cc  -o rain  rain.c
cc  -o q8  q8.c
cc  -o tetris  tetris.c
cc  -o lcd6  lcd6.c
      189.1 real        33.5 user       101.4 sys
#

It is perfectly usable at 8MHz. Even more retro!!!

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 9:18 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Code:
# time make
cc  -o rtc8563rd  rtc8563rd.c
cc  -o rtc8563wr  rtc8563wr.c
cc  -o rtc8563rd2os  rtc8563rd2os.c
cc  -o rtc3231rd  rtc3231rd.c
cc  -o rtc3231wr  rtc3231wr.c
cc  -o rtc3231rd2os  rtc3231rd2os.c
cc  -o i2cscan  i2cscan.c
      129.4 real        30.0 user        69.6 sys
# ./rtc3231rd2os -60
# date
Wed Oct 07 23:14:41 MET 2015
#

Above takes 17.8s at 80MHz/sdcard@13MHz.
Responses at prompt are OK.
Like an old machine :)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 9:25 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
Still faster than early VAXes. :)
How much power does Fubarino take at 8MHz?


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 9:44 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Fubarino SD @8MHz with several i2c devices connected (ADS1110, GY-80 module, DS3231+24LC64 module - not accessed during measurement) and 512MB microsd,
powered from usb/uart dongle, current at 5V Vin:
1. at prompt 8mA
2. during boot when messing with sdcard 20mA
3. when doing something it jumps between 8mA and 35mA (sporadic peaks), average 20mA.
Measured with retrostylish
Attachment:
avom.JPG
avom.JPG [ 23.65 KiB | Viewed 23734 times ]

at 60mA range :)
PS: a bright red color led lits on the ds3231 module, subtract 1.7mA :)
PS1: I replaced the LED resistors on the fubarino board with higher values (~kohms).

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 07, 2015 10:40 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
:) Dhrystone @8MHz
Code:
Nanoseconds for one run through Dhrystone: 227570
            Million Dhrystones per Second: 0.004
                                    DMIPS: 2.2

#

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 2:19 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
So reputable amperemeter - my respect! :)

Speed 2.2 DMIPS - wow, at 8mA we are still more that twice faster than VAX-11/780.


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 10:45 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
That is the half of power consumption of a single LED diode at the VAX front panel :).
With mx470 it would be a quarter..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 40 posts ]  Go to page Previous  1, 2

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission